app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: Wanx - Text-to-Image Demo
  use_icon_as_answer_icon: false
dependencies: []
kind: app
version: 0.5.0
workflow:
  conversation_variables: []
  environment_variables:
  - description: ''
    id: 2da4d60c-33f6-495e-b46d-a12e7d203e2b
    name: DASHSCOPE_API_KEY
    selector:
    - env
    - DASHSCOPE_API_KEY
    value: sk-xxxx
    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
        isInLoop: false
        sourceType: start
        targetType: http-request
      id: 1747623729369-source-1747730936834-target
      source: '1747623729369'
      sourceHandle: source
      target: '1747730936834'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: http-request
        targetType: code
      id: 1747730936834-source-1747731008171-target
      source: '1747730936834'
      sourceHandle: source
      target: '1747731008171'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: http-request
        targetType: code
      id: 1747731041630-source-1747731109908-target
      source: '1747731041630'
      sourceHandle: source
      target: '1747731109908'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: code
        targetType: end
      id: 1747731109908-source-1747731145007-target
      source: '1747731109908'
      sourceHandle: source
      target: '1747731145007'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: code
        targetType: code
      id: 1747731008171-source-1764296183090-target
      source: '1747731008171'
      sourceHandle: source
      target: '1764296183090'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: code
        targetType: http-request
      id: 1764296183090-source-1747731041630-target
      source: '1764296183090'
      sourceHandle: source
      target: '1747731041630'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: Start
        type: start
        variables:
        - label: user_input
          max_length: 48
          options: []
          required: true
          type: text-input
          variable: user_input
      height: 109
      id: '1747623729369'
      position:
        x: 30
        y: 279
      positionAbsolute:
        x: 30
        y: 279
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        authorization:
          config: null
          type: no-auth
        body:
          data:
          - id: key-value-97
            key: ''
            type: text
            value: "{\n    \"model\": \"wan2.2-t2i-flash\",\n    \"input\": {\n  \
              \      \"prompt\": \"{{#1747623729369.user_input#}}\"\n    },\n    \"\
              parameters\": {\n        \"n\": 1\n    }\n}"
          type: raw-text
        desc: ''
        headers: 'X-DashScope-Async:enable

          Authorization:Bearer {{#env.DASHSCOPE_API_KEY#}}

          Content-Type:application/json'
        method: post
        params: ''
        retry_config:
          max_retries: 3
          retry_enabled: true
          retry_interval: 100
        selected: false
        ssl_verify: true
        timeout:
          max_connect_timeout: 0
          max_read_timeout: 0
          max_write_timeout: 0
        title: step1-Get task-id
        type: http-request
        url: https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis
        variables: []
      height: 170
      id: '1747730936834'
      position:
        x: 334
        y: 279
      positionAbsolute:
        x: 334
        y: 279
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        code: "\ndef main(arg1: str) -> dict:\n    import json\n    import time\n\
          \    task_id = json.loads(arg1)['output']['task_id']\n    time.sleep(10)\n\
          \    return {\n        \"result\": task_id,\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: step2-Get task-id and sleep
        type: code
        variables:
        - value_selector:
          - '1747730936834'
          - body
          variable: arg1
      height: 52
      id: '1747731008171'
      position:
        x: 638
        y: 279
      positionAbsolute:
        x: 638
        y: 279
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        authorization:
          config: null
          type: no-auth
        body:
          data: []
          type: none
        desc: ''
        headers: Authorization:Bearer {{#env.DASHSCOPE_API_KEY#}}
        method: get
        params: ''
        retry_config:
          max_retries: 3
          retry_enabled: true
          retry_interval: 100
        selected: false
        ssl_verify: true
        timeout:
          max_connect_timeout: 0
          max_read_timeout: 0
          max_write_timeout: 0
        title: step3-Get image URL
        type: http-request
        url: https://dashscope-intl.aliyuncs.com/api/v1/tasks/{{#1747731008171.result#}}
        variables: []
      height: 157
      id: '1747731041630'
      position:
        x: 1242
        y: 279
      positionAbsolute:
        x: 1242
        y: 279
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        code: "\ndef main(arg1: str) -> dict:\n    import json\n    url = json.loads(arg1)['output']['results'][0]['url']\n\
          \    md_url = f\"![]({url})\"\n    return {\n        \"result\": md_url,\n\
          \    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: step4-Get image URL in MarkDown format
        type: code
        variables:
        - value_selector:
          - '1747731041630'
          - body
          variable: arg1
      height: 52
      id: '1747731109908'
      position:
        x: 1544.8751315610248
        y: 279
      positionAbsolute:
        x: 1544.8751315610248
        y: 279
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1747731109908'
          - result
          variable: show_image
        selected: false
        title: End
        type: end
      height: 88
      id: '1747731145007'
      position:
        x: 1850
        y: 279
      positionAbsolute:
        x: 1850
        y: 279
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        code: "\ndef main(arg1: str) -> dict:\n    import time\n    time.sleep(10)\n\
          \    return {\n        \"result\": arg1,\n    }"
        code_language: python3
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: Sleep
        type: code
        variables:
        - value_selector:
          - '1747731008171'
          - result
          value_type: string
          variable: arg1
      height: 52
      id: '1764296183090'
      position:
        x: 942
        y: 279
      positionAbsolute:
        x: 942
        y: 279
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    viewport:
      x: -780.2049083317115
      y: 343.8553092891209
      zoom: 0.8889928504980779
  rag_pipeline_variables: []
