app:
  description: 根据用户指定的知识库进行检索，返回相似片段结构化数据。
  icon: 🤖
  icon_background: '#FFEAD5'
  mode: workflow
  name: 动态知识库检索
  use_icon_as_answer_icon: false
dependencies: []
kind: app
version: 0.4.0
workflow:
  conversation_variables: []
  environment_variables: []
  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: code
        targetType: iteration
      id: 1747125551298-source-1747125586388-target
      selected: false
      source: '1747125551298'
      sourceHandle: source
      target: '1747125586388'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: true
        isInLoop: false
        iteration_id: '1747125586388'
        sourceType: iteration-start
        targetType: http-request
      id: 1747125586388start-source-1747125795256-target
      source: 1747125586388start
      sourceHandle: source
      target: '1747125795256'
      targetHandle: target
      type: custom
      zIndex: 1002
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: iteration
        targetType: code
      id: 1747125586388-source-1747125859504-target
      source: '1747125586388'
      sourceHandle: source
      target: '1747125859504'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInIteration: false
        isInLoop: false
        sourceType: code
        targetType: end
      id: 1747125859504-source-1747125871123-target
      source: '1747125859504'
      sourceHandle: source
      target: '1747125871123'
      targetHandle: target
      type: custom
      zIndex: 0
    - data:
        isInLoop: false
        sourceType: start
        targetType: code
      id: 1747125462435-source-1747125551298-target
      source: '1747125462435'
      sourceHandle: source
      target: '1747125551298'
      targetHandle: target
      type: custom
      zIndex: 0
    nodes:
    - data:
        desc: ''
        selected: false
        title: 开始
        type: start
        variables:
        - label: 知识库集（多个Id使用英文逗号隔开）
          max_length: 256
          options: []
          required: true
          type: text-input
          variable: dataset_ids
        - label: 用户问题
          max_length: 256
          options: []
          required: true
          type: text-input
          variable: query
      height: 114
      id: '1747125462435'
      position:
        x: 80
        y: 282
      positionAbsolute:
        x: 80
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        code: "\nimport json\ndef main(dataset_ids:str):\n    return {\n        \"\
          result\": json.loads(dataset_ids)\n    }\n"
        code_language: python3
        desc: ''
        outputs:
          result:
            children: null
            type: array[string]
        selected: false
        title: 知识库集
        type: code
        variables:
        - value_selector:
          - '1747125462435'
          - dataset_ids
          value_type: string
          variable: dataset_ids
      height: 52
      id: '1747125551298'
      position:
        x: 682
        y: 282
      positionAbsolute:
        x: 682
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        desc: ''
        error_handle_mode: terminated
        height: 231
        is_parallel: true
        iterator_selector:
        - '1747125551298'
        - result
        output_selector:
        - '1747125795256'
        - body
        output_type: array[string]
        parallel_nums: 10
        selected: false
        start_node_id: 1747125586388start
        title: 迭代
        type: iteration
        width: 388
      height: 231
      id: '1747125586388'
      position:
        x: 988
        y: 282
      positionAbsolute:
        x: 988
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 388
      zIndex: 1
    - data:
        desc: ''
        isInIteration: true
        selected: false
        title: ''
        type: iteration-start
      draggable: false
      height: 48
      id: 1747125586388start
      parentId: '1747125586388'
      position:
        x: 24
        y: 68
      positionAbsolute:
        x: 1012
        y: 350
      selectable: false
      sourcePosition: right
      targetPosition: left
      type: custom-iteration-start
      width: 44
      zIndex: 1002
    - data:
        authorization:
          config: null
          type: no-auth
        body:
          data:
          - id: key-value-274
            key: ''
            type: text
            value: '{

              "query": {{#1747125462435.query#}}

              }'
          type: json
        desc: ''
        headers: 'Authorization:Bearer dataset-HeDK9gHBqPnI4rBZ2q2Hm7rV

          Content-Type:application/json'
        isInIteration: true
        isInLoop: false
        iteration_id: '1747125586388'
        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: HTTP 请求
        type: http-request
        url: http://192.168.0.64:7700/v1/datasets/{{#1747125586388.item#}}/retrieve
        variables: []
      height: 157
      id: '1747125795256'
      parentId: '1747125586388'
      position:
        x: 120.421417167448
        y: 54
      positionAbsolute:
        x: 1108.421417167448
        y: 336
      selected: true
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
      zIndex: 1002
    - data:
        code: "\nfunction main({arg1}) {\n    const result = [];\n    \n    // 判断arg1是否为空\n\
          \    if (!arg1 || arg1.length === 0) {\n        return {\n            result:\
          \ JSON.stringify([])  // 返回空数组的JSON字符串\n        };\n    }\n    \n    //\
          \ 遍历arg1中的每个元素\n    for (const str of arg1) {\n        try {\n         \
          \   // 解析JSON\n            const parsed = JSON.parse(str);\n           \
          \ // 检查是否有records属性且不为空数组\n            if (parsed.records && Array.isArray(parsed.records)\
          \ && parsed.records.length > 0) {\n                result.push(...parsed.records)\n\
          \            }\n        } catch (e) {\n            // 如果JSON解析失败,跳过这个元素\n\
          \            console.error('Failed to parse JSON:', e);\n        }\n   \
          \ }\n    \n    // 将结果数组转换为JSON字符串返回\n    return {\n        result: JSON.stringify(result)\n\
          \    }\n}\n"
        code_language: javascript
        desc: ''
        outputs:
          result:
            children: null
            type: string
        selected: false
        title: 知识库检索结果整理
        type: code
        variables:
        - value_selector:
          - '1747125586388'
          - output
          variable: arg1
      height: 52
      id: '1747125859504'
      position:
        x: 1436
        y: 282
      positionAbsolute:
        x: 1436
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    - data:
        desc: ''
        outputs:
        - value_selector:
          - '1747125859504'
          - result
          value_type: string
          variable: output
        selected: false
        title: 结束
        type: end
      height: 88
      id: '1747125871123'
      position:
        x: 1739
        y: 282
      positionAbsolute:
        x: 1739
        y: 282
      selected: false
      sourcePosition: right
      targetPosition: left
      type: custom
      width: 242
    viewport:
      x: 116.27083894320822
      y: 126.27330841264018
      zoom: 0.8705505632961247
  rag_pipeline_variables: []
