From c0cbb059fe0d8582adb6070748b1c7f5d8cccf98 Mon Sep 17 00:00:00 2001 From: wangys <3401275564@qq.com> Date: Wed, 31 Dec 2025 17:36:15 +0800 Subject: [PATCH] =?UTF-8?q?dify=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- urbanLifelineServ/dify/动态知识库检索.yml | 368 ++++++++++++++ urbanLifelineServ/dify/泰豪小电.yml | 559 ++++++++++++++++++++++ 2 files changed, 927 insertions(+) create mode 100644 urbanLifelineServ/dify/动态知识库检索.yml create mode 100644 urbanLifelineServ/dify/泰豪小电.yml diff --git a/urbanLifelineServ/dify/动态知识库检索.yml b/urbanLifelineServ/dify/动态知识库检索.yml new file mode 100644 index 00000000..d5a30458 --- /dev/null +++ b/urbanLifelineServ/dify/动态知识库检索.yml @@ -0,0 +1,368 @@ +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_batch_limit: 10 + image_file_size_limit: 10 + single_chunk_attachment_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: true + 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: false + 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: -33.22404773079188 + y: -134.2994836345366 + zoom: 0.8705505632961247 + rag_pipeline_variables: [] diff --git a/urbanLifelineServ/dify/泰豪小电.yml b/urbanLifelineServ/dify/泰豪小电.yml new file mode 100644 index 00000000..6d65dd4a --- /dev/null +++ b/urbanLifelineServ/dify/泰豪小电.yml @@ -0,0 +1,559 @@ +app: + description: '' + icon: 🤖 + icon_background: '#FFEAD5' + mode: advanced-chat + name: 泰豪小电 + use_icon_as_answer_icon: false +dependencies: +- current_identifier: null + type: marketplace + value: + marketplace_plugin_unique_identifier: langgenius/siliconflow:0.0.38@4795747d4fca05fee9daf34b1bcc110ffbbfcd9112f5f9e914f90b8b5dd549e5 + version: null +kind: app +version: 0.5.0 +workflow: + conversation_variables: + - description: 设备代码 + id: 8a1c2cb7-376c-424a-914a-52e4155d9398 + name: device_code + selector: + - conversation + - device_code + value: '' + value_type: string + - description: 知识库访问apiKey + id: 9e385516-ad32-4ab5-ac90-1fa7c5126d06 + name: dataset_apikey + selector: + - conversation + - dataset_apikey + value: '' + value_type: string + - description: 知识库id集合,json序列化 + id: a9aaff15-cf7a-4054-a607-8ce319005703 + name: datasets + selector: + - conversation + - datasets + value: '' + value_type: string + 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: 500 + image_file_batch_limit: 10 + image_file_size_limit: 10 + single_chunk_attachment_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: if-else + id: 1766469212796-source-1766998282613-target + selected: false + source: '1766469212796' + sourceHandle: source + target: '1766998282613' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: start + targetType: if-else + id: 1766469212796-source-1766998308433-target + selected: false + source: '1766469212796' + sourceHandle: source + target: '1766998308433' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: if-else + targetType: assigner + id: 1766998282613-true-1766998338007-target + selected: false + source: '1766998282613' + sourceHandle: 'true' + target: '1766998338007' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: if-else + targetType: assigner + id: 1766998308433-true-1766998352957-target + selected: false + source: '1766998308433' + sourceHandle: 'true' + target: '1766998352957' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: assigner + targetType: tool + id: 1766998338007-source-1766998463133-target + selected: false + source: '1766998338007' + sourceHandle: source + target: '1766998463133' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: assigner + targetType: tool + id: 1766998352957-source-1766998463133-target + selected: false + source: '1766998352957' + sourceHandle: source + target: '1766998463133' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: if-else + targetType: tool + id: 1766998282613-false-1766998463133-target + selected: false + source: '1766998282613' + sourceHandle: 'false' + target: '1766998463133' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: if-else + targetType: tool + id: 1766998308433-false-1766998463133-target + selected: false + source: '1766998308433' + sourceHandle: 'false' + target: '1766998463133' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: tool + targetType: llm + id: 1766998463133-source-1766998751026-target + source: '1766998463133' + sourceHandle: source + target: '1766998751026' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: llm + targetType: answer + id: 1766998751026-source-answer-target + source: '1766998751026' + sourceHandle: source + target: answer + targetHandle: target + type: custom + zIndex: 0 + nodes: + - data: + selected: false + title: 用户输入 + type: start + variables: + - default: '' + hint: '' + label: 知识库id集合,json序列化 + max_length: 4096 + options: [] + placeholder: '' + required: true + type: paragraph + variable: datasets + - default: '' + hint: '' + label: 知识库访问apiKey + max_length: 100 + options: [] + placeholder: '' + required: true + type: text-input + variable: dataset_apikey + height: 135 + id: '1766469212796' + position: + x: 0 + y: 33 + positionAbsolute: + x: 0 + y: 33 + selected: true + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + answer: '{{#1766998751026.text#}}' + selected: false + title: 直接回复 + type: answer + variables: [] + height: 103 + id: answer + position: + x: 1770 + y: 87 + positionAbsolute: + x: 1770 + y: 87 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + cases: + - case_id: 'true' + conditions: + - comparison_operator: empty + id: 8edef3b0-823d-481c-a4eb-254a0bd42535 + value: '' + varType: string + variable_selector: + - conversation + - datasets + id: 'true' + logical_operator: and + selected: false + title: datasets初始化 + type: if-else + height: 124 + id: '1766998282613' + position: + x: 362 + y: 16 + positionAbsolute: + x: 362 + y: 16 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + cases: + - case_id: 'true' + conditions: + - comparison_operator: empty + id: 2976abfb-0b2d-43ec-bb02-f547892e39de + value: '' + varType: string + variable_selector: + - conversation + - dataset_apikey + id: 'true' + logical_operator: and + selected: false + title: 条件分支 2 + type: if-else + height: 124 + id: '1766998308433' + position: + x: 362 + y: 220 + positionAbsolute: + x: 362 + y: 220 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + items: + - input_type: variable + operation: over-write + value: + - '1766469212796' + - datasets + variable_selector: + - conversation + - datasets + write_mode: over-write + selected: false + title: 变量赋值 + type: assigner + version: '2' + height: 84 + id: '1766998338007' + position: + x: 724 + y: 0 + positionAbsolute: + x: 724 + y: 0 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + items: + - input_type: variable + operation: over-write + value: + - '1766469212796' + - dataset_apikey + variable_selector: + - conversation + - dataset_apikey + write_mode: over-write + selected: false + title: 变量赋值 2 + type: assigner + version: '2' + height: 84 + id: '1766998352957' + position: + x: 724 + y: 185 + positionAbsolute: + x: 724 + y: 185 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + is_team_authorization: true + paramSchemas: + - auto_generate: null + default: null + form: llm + human_description: + en_US: '' + ja_JP: '' + pt_BR: '' + zh_Hans: '' + label: + en_US: 知识库集(多个Id使用英文逗号隔开) + ja_JP: 知识库集(多个Id使用英文逗号隔开) + pt_BR: 知识库集(多个Id使用英文逗号隔开) + zh_Hans: 知识库集(多个Id使用英文逗号隔开) + llm_description: '' + max: null + min: null + name: dataset_ids + options: [] + placeholder: + en_US: '' + ja_JP: '' + pt_BR: '' + zh_Hans: '' + precision: null + required: true + scope: null + template: null + type: string + - auto_generate: null + default: null + form: llm + human_description: + en_US: '' + ja_JP: '' + pt_BR: '' + zh_Hans: '' + label: + en_US: 用户问题 + ja_JP: 用户问题 + pt_BR: 用户问题 + zh_Hans: 用户问题 + llm_description: '' + max: null + min: null + name: query + options: [] + placeholder: + en_US: '' + ja_JP: '' + pt_BR: '' + zh_Hans: '' + precision: null + required: true + scope: null + template: null + type: string + - auto_generate: null + default: '' + form: llm + human_description: + en_US: '' + ja_JP: '' + pt_BR: '' + zh_Hans: '' + label: + en_US: dataset_apikey + ja_JP: dataset_apikey + pt_BR: dataset_apikey + zh_Hans: dataset_apikey + llm_description: '' + max: null + min: null + name: dataset_apikey + options: [] + placeholder: + en_US: '' + ja_JP: '' + pt_BR: '' + zh_Hans: '' + precision: null + required: true + scope: null + template: null + type: string + params: + dataset_apikey: '' + dataset_ids: '' + query: '' + plugin_id: null + plugin_unique_identifier: null + provider_icon: + background: '#FFEAD5' + content: 🤖 + provider_id: 5d6141ab-e1ad-401f-a8b6-da6ce4dd682f + provider_name: 动态知识库检索 + provider_type: workflow + selected: false + title: 动态知识库检索 + tool_configurations: {} + tool_description: 根据用户指定的知识库进行检索,返回相似片段结构化数据。 + tool_label: 动态知识库检索 + tool_name: dynamic_dataset + tool_node_version: '2' + tool_parameters: + dataset_apikey: + type: mixed + value: '{{#conversation.dataset_apikey#}}' + dataset_ids: + type: mixed + value: '{{#conversation.datasets#}}' + query: + type: mixed + value: '{{#sys.query#}}' + type: tool + height: 52 + id: '1766998463133' + position: + x: 1086 + y: 113 + positionAbsolute: + x: 1086 + y: 113 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + context: + enabled: true + variable_selector: + - '1766998463133' + - text + model: + completion_params: + temperature: 0.7 + mode: chat + name: Pro/moonshotai/Kimi-K2-Instruct + provider: langgenius/siliconflow/siliconflow + prompt_config: + jinja2_variables: + - value_selector: + - '1766998463133' + - text + variable: text + prompt_template: + - edition_type: jinja2 + id: 1ee839fc-fff4-41b5-bbe3-b778b428cef4 + jinja2_text: 根据知识库内容{{ text }}回答用户问题 + role: system + text: '' + selected: false + title: LLM + type: llm + vision: + enabled: false + height: 88 + id: '1766998751026' + position: + x: 1428 + y: 95 + positionAbsolute: + x: 1428 + y: 95 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + viewport: + x: -671.7 + y: 334.55 + zoom: 0.7 + rag_pipeline_variables: []