app:
  description: 本工作流主要是实现儿童故事绘本文本分镜提示词，通过分镜提示词生成图片，然后把后端图片和语音合成一个动画视频功能。
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: advanced-chat
  name: 儿童故事绘本文生视频语音合成版
  use_icon_as_answer_icon: false
kind: app
version: 0.1.5
workflow:
  conversation_variables: []
  environment_variables:
  - description: ''
    id: ef124d5b-836e-43e7-a756-641ded7504b5
    name: apikey
    selector:
    - env
    - apikey
    value: zhouhui-1258720957
    value_type: string
  features:
    file_upload:
      allowed_file_extensions:
      - .JPG
      - .JPEG
      - .PNG
      - .GIF
      - .WEBP
      - .SVG
      allowed_file_types:
      - image
      allowed_file_upload_methods:
      - local_file
      - remote_url
      enabled: false
      fileUploadConfig:
        audio_file_size_limit: 50
        batch_count_limit: 5
        file_size_limit: 15
        image_file_size_limit: 10
        video_file_size_limit: 100
        workflow_file_upload_limit: 10
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
      number_limits: 3
    opening_statement: ''
    retriever_resource:
      enabled: true
    sensitive_word_avoidance:
      enabled: false
    speech_to_text:
      enabled: false
    suggested_questions: []
    suggested_questions_after_answer:
      enabled: false
    text_to_speech:
      enabled: false
      language: ''
      voice: ''
  graph:
    edges:
    - data:
        isInIteration: false
        sourceType: start
        targetType: http-request
      id: 1742285983458-source-1742287808790-target
      source: '1742285983458'
      sourceHandle: source
      target: '1742287808790'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: http-request
        targetType: code
      id: 1742287808790-source-1742288094905-target
      source: '1742287808790'
      sourceHandle: source
      target: '1742288094905'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: answer
      id: 1742288094905-source-answer-target
      source: '1742288094905'
      sourceHandle: source
      target: answer
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: 文本提示词
          max_length: 256
          options: []
          required: true
          type: text-input
          variable: prompt
        - label: 语言
          max_length: 48
          options:
          - zh-CN
          - zh-TW
          - en-US
          - ja-JP
          - ko-KR
          required: true
          type: select
          variable: language
        - label: 分镜数量
          max_length: 48
          options:
          - '3'
          - '4'
          - '5'
          required: true
          type: select
          variable: segments
        - label: 语音名称
          max_length: 48
          options:
          - zh-CN-XiaoxiaoNeural
          - zh-CN-XiaoyiNeural
          - zh-CN-YunjianNeural
          - zh-CN-YunxiNeural
          - zh-CN-YunxiaNeural
          - zh-CN-YunyangNeural
          - es-US-AlonsoNeural
          - es-US-PalomaNeural
          - zh-HK-HiuGaaiNeural
          - zh-HK-WanLungNeural
          - zh-TW-HsiaoChenNeural
          - zh-TW-YunJheNeural
          - zu-ZA-ThandoNeural
          - zu-ZA-ThembaNeural
          - ja-JP-KeitaNeural
          - ja-JP-NanamiNeural
          required: true
          type: select
          variable: voice_name
        - label: 语音速率
          max_length: 48
          options:
          - '1.0'
          - '1.2'
          - '0.8'
          required: true
          type: select
          variable: voice_rate
        - label: 图片分辨率
          max_length: 48
          options:
          - 1024*1024
          - 512*512
          - 1024*768
          - 1024*682
          - 1024*576
          - 768*1024
          - 682*1024
          - 576*1024
          required: true
          type: select
          variable: resolution
        - label: 文本模型提供厂商
          max_length: 48
          options:
          - siliconflow
          - intern
          - aliyun
          required: true
          type: select
          variable: text_llm_provider
        - label: 文本模型名称
          max_length: 48
          options:
          - Qwen/QwQ-32B
          - Pro/Qwen/Qwen2.5-7B-Instruct
          - internlm3-latest
          required: true
          type: select
          variable: text_llm_model
        - label: 文生图模型提供厂商
          max_length: 48
          options:
          - siliconflow
          required: true
          type: select
          variable: image_llm_provider
        - label: 文生图模型
          max_length: 48
          options:
          - black-forest-labs/FLUX.1-schnell
          required: true
          type: select
          variable: image_llm_model
        - label: 备注说明
          max_length: 48
          options: []
          required: false
          type: text-input
          variable: dagf
      height: 349
      id: '1742285983458'
      position:
        x: -4.5
        y: 282
      positionAbsolute:
        x: -4.5
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        answer: '{{#1742288094905.result#}}'
        desc: ''
        selected: false
        title: 直接回复
        type: answer
        variables: []
      height: 102
      id: answer
      position:
        x: 940
        y: 282
      positionAbsolute:
        x: 940
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        authorization:
          config: null
          type: no-auth
        body:
          data:
          - id: key-value-1
            key: ''
            type: text
            value: "{\n            \"story_prompt\": \"{{#1742285983458.prompt#}}\"\
              ,\n            \"segments\": \"{{#1742285983458.segments#}}\",\n   \
              \         \"language\": \"{{#1742285983458.language#}}\",\n        \
              \    \"voice_name\": \"{{#1742285983458.voice_name#}}\",\n         \
              \   \"voice_rate\": \"{{#1742285983458.voice_rate#}}\",\n          \
              \  \"resolution\": \"{{#1742285983458.resolution#}}\",\n           \
              \ \"text_llm_provider\": \"{{#1742285983458.text_llm_provider#}}\",\n\
              \            \"image_llm_provider\": \"{{#1742285983458.image_llm_provider#}}\"\
              ,\n            \"text_llm_model\": \"{{#1742285983458.text_llm_model#}}\"\
              ,\n            \"image_llm_model\": \"{{#1742285983458.image_llm_model#}}\"\
              \n}"
          type: json
        desc: ''
        headers: Authorization:Bearer {{#env.apikey#}}
        method: post
        params: ''
        retry_config:
          max_retries: 1
          retry_enabled: false
          retry_interval: 100
        selected: false
        timeout:
          connect: 300
          max_connect_timeout: 0
          max_read_timeout: 0
          max_write_timeout: 0
          read: 300
          write: 300
        title: HTTP 请求后端服务接口
        type: http-request
        url: http://192.168.1.3:8085/story/generatestory
        variables: []
      height: 109
      id: '1742287808790'
      position:
        x: 299
        y: 282
      positionAbsolute:
        x: 299
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        code: "import json\n\ndef main(arg1: str) -> dict:\n    try:\n        # 解析外层的\
          \ JSON 字符串\n        data = json.loads(arg1)\n        \n        # 检查 success\
          \ 字段是否为 True\n        if not data.get(\"success\", False):\n           \
          \ return {\"error\": \"操作失败，'success' 字段为 False\"}\n        \n        #\
          \ 提取 data 字段中的 video_url\n        video_data = data.get(\"data\")\n    \
          \    if not video_data or \"video_url\" not in video_data:\n           \
          \ return {\"error\": \"JSON 中缺少 'data.video_url' 字段\"}\n        \n     \
          \   video_url = video_data[\"video_url\"]\n        \n        # 定义文件名（可以根据需要调整）\n\
          \        filename = \"生成视频\"\n        \n        # 生成 Markdown 格式的 HTML <video>\
          \ 标签\n        markdown_result = f\"<video controls><source src='{video_url}'\
          \ type='video/mp4'>{filename}</video>\"\n        \n        # 返回结果字典\n  \
          \      return {\"result\": markdown_result}\n    \n    except json.JSONDecodeError:\n\
          \        return {\"error\": \"无效的 JSON 字符串\"}\n    except Exception as e:\n\
          \        return {\"error\": f\"发生未知错误: {str(e)}\"}"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 代码执行
        type: code
        variables:
        - value_selector:
          - '1742287808790'
          - body
          variable: arg1
      height: 53
      id: '1742288094905'
      position:
        x: 603
        y: 282
      positionAbsolute:
        x: 603
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        author: 周辉
        desc: ''
        height: 88
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"本工作流流主要通过后端代码实现儿童故事绘本的视频合成，使用http请求实现","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}'
        theme: blue
        title: ''
        type: ''
        width: 497
      height: 88
      id: '1742315658507'
      position:
        x: 12.311861933061579
        y: 640.9963846471254
      positionAbsolute:
        x: 12.311861933061579
        y: 640.9963846471254
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 497
    viewport:
      x: 123.75441571960255
      y: -328.78731251421004
      zoom: 1.3195079369401868
