app:
  description: ''
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: split txt  request LLM
  use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
  conversation_variables: []
  environment_variables: []
  features:
    file_upload:
      image:
        enabled: false
        number_limits: 3
        transfer_methods:
        - local_file
        - remote_url
    opening_statement: ''
    retriever_resource:
      enabled: false
    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: code
      id: 1711067409646-source-1717916867969-target
      source: '1711067409646'
      sourceHandle: source
      target: '1717916867969'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: code
        targetType: iteration
      id: 1717916867969-source-1717916955547-target
      source: '1717916867969'
      sourceHandle: source
      target: '1717916955547'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: iteration
        targetType: template-transform
      id: 1717916955547-source-1717917057450-target
      source: '1717916955547'
      sourceHandle: source
      target: '1717917057450'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        sourceType: template-transform
        targetType: end
      id: 1717917057450-source-1711068257370-target
      source: '1717917057450'
      sourceHandle: source
      target: '1711068257370'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: true
        iteration_id: '1717916955547'
        sourceType: iteration-start
        targetType: llm
      id: 1717916955547start0-source-1717916961837-target
      source: 1717916955547start0
      sourceHandle: source
      target: '1717916961837'
      targetHandle: target
      type: custom
      zIndex: 1002
    - data:
        isInIteration: true
        iteration_id: '1717916955547'
        sourceType: llm
        targetType: template-transform
      id: 1717916961837-source-1726916585147-target
      source: '1717916961837'
      sourceHandle: source
      target: '1726916585147'
      targetHandle: target
      type: custom
      zIndex: 1002
    nodes:
    - data:
        desc: ''
        selected: false
        title: Start
        type: start
        variables:
        - label: Input Text
          max_length: null
          options: []
          required: true
          type: paragraph
          variable: input_text
      dragging: false
      height: 90
      id: '1711067409646'
      position:
        x: 30
        y: 301.5
      positionAbsolute:
        x: 30
        y: 301.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1717917057450'
          - output
          variable: final
        selected: false
        title: End
        type: end
      height: 90
      id: '1711068257370'
      position:
        x: 1871.55160792371
        y: 301.5
      positionAbsolute:
        x: 1871.55160792371
        y: 301.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        code: "\ndef main(input_text: str) -> str:\n    token_limit = 500\n    overlap\
          \ = 50\n    chunk_size = int(token_limit * 6 * (4/3))\n\n        # Initialize\
          \ variables\n    chunks = []\n    start_index = 0\n    text_length = len(input_text)\n\
          \n    # Loop until the end of the text is reached\n    while start_index\
          \ < text_length:\n        # If we are not at the beginning, adjust the start_index\
          \ to ensure overlap\n        if start_index > 0:\n            start_index\
          \ -= overlap\n\n        # Calculate end index for the current chunk\n  \
          \      end_index = start_index + chunk_size\n        if end_index > text_length:\n\
          \            end_index = text_length\n\n        # Add the current chunk\
          \ to the list\n        chunks.append(input_text[start_index:end_index])\n\
          \n        # Update the start_index for the next chunk\n        start_index\
          \ += chunk_size\n\n    return {\n        \"chunks\": chunks,\n    }\n"
        code_language: python3
        dependencies: []
        desc: 'token_limit = 500

          overlap = 50'
        outputs:
          chunks:
            children: null
            type: array[string]
        selected: false
        title: Code
        type: code
        variables:
        - value_selector:
          - '1711067409646'
          - input_text
          variable: input_text
      height: 98
      id: '1717916867969'
      position:
        x: 336
        y: 301.5
      positionAbsolute:
        x: 336
        y: 301.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        desc: 'Take good care on maximum number of iterations.  '
        height: 243.7625079562925
        iterator_selector:
        - '1717916867969'
        - chunks
        output_selector:
        - '1717916961837'
        - text
        output_type: array[string]
        selected: false
        startNodeType: llm
        start_node_id: 1717916955547start0
        title: Iteration
        type: iteration
        width: 719.5302202718137
      height: 244
      id: '1717916955547'
      position:
        x: 659.7206923961915
        y: 301.5
      positionAbsolute:
        x: 659.7206923961915
        y: 301.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 720
      zIndex: 1
    - data:
        context:
          enabled: false
          variable_selector: []
        desc: ''
        isInIteration: true
        isIterationStart: true
        iteration_id: '1717916955547'
        model:
          completion_params: {}
          mode: chat
          name: Doubao-pro-4k
          provider: volcengine_maas
        prompt_template:
        - id: 7261280b-cb27-4f84-8363-b93e09246d16
          role: system
          text: "<Task> 请根据我接下来提交的内容，获取数据， 按照标题，阅读数， 点赞数，日期做个表格, 按照markdown格式输出就行。如果对应字段你没有值\
            \ ，直接输入省略号\n\n<Input Text> \n{{#1717916955547.item#}}\n\n"
        selected: false
        title: 'Identify Terms '
        type: llm
        variables: []
        vision:
          enabled: false
      extent: parent
      height: 98
      id: '1717916961837'
      parentId: '1717916955547'
      position:
        x: 155.53022027181373
        y: 71.7625079562925
      positionAbsolute:
        x: 815.2509126680052
        y: 373.2625079562925
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
      zIndex: 1001
    - data:
        desc: 'Combine all chunks of translation. '
        selected: false
        template: '{{ translated_text | join('' '') }}'
        title: Template
        type: template-transform
        variables:
        - value_selector:
          - '1717916955547'
          - output
          variable: translated_text
      height: 82
      id: '1717917057450'
      position:
        x: 1505.6618955766382
        y: 301.5
      positionAbsolute:
        x: 1505.6618955766382
        y: 301.5
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
    - data:
        author: Dify
        desc: ''
        height: 186
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Code
          node separates the input_text into chunks with length of token_limit. Each
          chunk overlap with each other to make sure the texts are consistent.  ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0},{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1,"textFormat":0},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"The
          code node outputs an array of segmented texts of input_texts. ","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: 340
      height: 186
      id: '1718990593686'
      position:
        x: 259.3026056936437
        y: 451.6924912936374
      positionAbsolute:
        x: 259.3026056936437
        y: 451.6924912936374
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 340
    - data:
        author: Dify
        desc: ''
        height: 128
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Iterate
          through all the elements in output of the code node and translate each chunk
          using a three steps translation workflow. ","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: 355
      height: 128
      id: '1718991836605'
      position:
        x: 764.3891977435923
        y: 530.8917807505335
      positionAbsolute:
        x: 764.3891977435923
        y: 530.8917807505335
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 355
    - data:
        author: Dify
        desc: ''
        height: 126
        selected: false
        showAuthor: true
        text: '{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Avoid
          using a high token_limit, LLM''s performance decreases with longer context
          length for gpt-4o. ","type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1,"textFormat":0},{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1,"textFormat":0},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"Recommend
          to use less than or equal to 1000 tokens. ","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: yellow
        title: ''
        type: ''
        width: 351
      height: 126
      id: '1718991882984'
      position:
        x: 304.49115824454367
        y: 148.4042994607805
      positionAbsolute:
        x: 304.49115824454367
        y: 148.4042994607805
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom-note
      width: 351
    - data:
        desc: ''
        isInIteration: true
        selected: false
        title: ''
        type: iteration-start
      draggable: false
      height: 44
      id: 1717916955547start0
      parentId: '1717916955547'
      position:
        x: 24
        y: 68
      positionAbsolute:
        x: 683.7206923961915
        y: 369.5
      selectable: false
      sourcePosition: right
      targetPosition: left
      type: custom-iteration-start
      width: 44
      zIndex: 1002
    - data:
        desc: ''
        isInIteration: true
        iteration_id: '1717916955547'
        selected: false
        template: '{{ arg1 }}'
        title: 打印结果
        type: template-transform
        variables:
        - value_selector:
          - '1717916961837'
          - text
          variable: arg1
      extent: parent
      height: 54
      id: '1726916585147'
      parentId: '1717916955547'
      position:
        x: 428.4630827470146
        y: 92.47393297282525
      positionAbsolute:
        x: 1088.183775143206
        y: 393.97393297282525
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 244
      zIndex: 1002
    viewport:
      x: -68.91876743371563
      y: -47.39485691467473
      zoom: 0.6957624230473846
