Files
schoolNews/schoolNewsServ/.bin/dify/动态知识库检索.yml
2025-11-28 15:16:47 +08:00

367 lines
9.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

app:
description: 根据用户指定的知识库进行检索,返回相似片段结构化数据。
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
name: 动态知识库检索
use_icon_as_answer_icon: false
dependencies: []
kind: app
version: 0.5.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
- default: ''
hint: ''
label: dataset_apikey
max_length: 100
options: []
placeholder: ''
required: true
type: text-input
variable: dataset_apikey
height: 161
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 {{#1747125462435.dataset_apikey#}}
Content-Type:application/json'
isInIteration: true
isInLoop: false
iteration_id: '1747125586388'
method: post
params: ''
retry_config:
max_retries: 3
retry_enabled: false
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://nginx:80/v1/datasets/{{#1747125586388.item#}}/retrieve
variables: []
height: 111
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: -967.224047730792
y: 147.70051636546336
zoom: 0.8705505632961247
rag_pipeline_variables: []