From 99eb18c4bdd9df5ad76b9650e564114f7fde3727 Mon Sep 17 00:00:00 2001 From: wangys <3401275564@qq.com> Date: Thu, 27 Nov 2025 11:07:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- build.sh | 24 +- docker/schoolNews/dify/动态知识库检索.yml | 357 +++++++ docker/schoolNews/dify/思政小帮手.yml | 1075 +++++++++++++++++++++ docker/schoolNews/dify/部署注意点.md | 9 + 5 files changed, 1445 insertions(+), 23 deletions(-) create mode 100644 docker/schoolNews/dify/动态知识库检索.yml create mode 100644 docker/schoolNews/dify/思政小帮手.yml create mode 100644 docker/schoolNews/dify/部署注意点.md diff --git a/.gitignore b/.gitignore index 20c1691..a0ae21b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ build_output # Docker volumes(运行时数据,不纳入版本控制) docker/schoolNews/volumes/ -docker/schoolNews/crawler \ No newline at end of file +docker/schoolNews/crawler +docker.zip \ No newline at end of file diff --git a/build.sh b/build.sh index 120a4a8..f210068 100755 --- a/build.sh +++ b/build.sh @@ -104,23 +104,7 @@ done # 确定保存版本 if [ "${DO_SAVE}" = true ]; then if [ -z "${SAVE_VERSION}" ]; then - if [ "${DO_BUILD}" = true ]; then - # 如果有build参数,保存刚构建的版本 - SAVE_VERSION="${IMAGE_VERSION}" - else - # 如果没有build参数且未指定版本,提示错误 - echo "" - log_error "❌ 错误:只使用save时必须指定版本" - echo "" - echo "正确用法:" - echo " 1. 保存指定版本: ./build.sh ${BUILD_TARGET} save=20251124_143025" - echo " 2. 构建并保存: ./build.sh ${BUILD_TARGET} build save" - echo "" - echo "查看可用版本:" - echo " docker images | grep school-news" - echo "" - exit 1 - fi + SAVE_VERSION="latest" fi fi @@ -132,11 +116,7 @@ log_info "构建版本: ${IMAGE_VERSION}" log_info "编译代码: ${DO_BUILD}" log_info "保存镜像: ${DO_SAVE}" if [ "${DO_SAVE}" = true ]; then - if [ "${DO_BUILD}" = true ]; then - log_info "保存版本: ${SAVE_VERSION} (自动使用构建版本)" - else - log_info "保存版本: ${SAVE_VERSION} (指定版本)" - fi + log_info "保存版本: ${SAVE_VERSION}" fi log_info "项目路径: ${PROJECT_ROOT}" echo "==========================================" diff --git a/docker/schoolNews/dify/动态知识库检索.yml b/docker/schoolNews/dify/动态知识库检索.yml new file mode 100644 index 0000000..285eec0 --- /dev/null +++ b/docker/schoolNews/dify/动态知识库检索.yml @@ -0,0 +1,357 @@ +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: [] diff --git a/docker/schoolNews/dify/思政小帮手.yml b/docker/schoolNews/dify/思政小帮手.yml new file mode 100644 index 0000000..dd725bf --- /dev/null +++ b/docker/schoolNews/dify/思政小帮手.yml @@ -0,0 +1,1075 @@ +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.34@1c203017d8ef49fd9152696a42e6dc71ecf272b115d8caf731c99ee0d2956dce + version: null +- current_identifier: null + type: marketplace + value: + marketplace_plugin_unique_identifier: anspire/anspire_search:0.0.9@a59824e9507c05c81d582cc5d8384197215d91bf5c787150d8aad723eb5d1a69 + version: null +kind: app +version: 0.4.0 +workflow: + conversation_variables: + - description: '' + id: e18aacca-16a2-4d93-80c4-5a85ead53ae4 + 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 + - document + allowed_file_upload_methods: + - remote_url + - local_file + enabled: true + 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: + sourceType: llm + targetType: answer + id: llm-answer + selected: false + source: llm + sourceHandle: source + target: answer + targetHandle: target + type: custom + - data: + isInIteration: true + isInLoop: false + iteration_id: '1762339969303' + sourceType: iteration-start + targetType: document-extractor + id: 1762339969303start-source-1762339981310-target + selected: false + source: 1762339969303start + sourceHandle: source + target: '1762339981310' + targetHandle: target + type: custom + zIndex: 1002 + - data: + isInLoop: false + sourceType: iteration + targetType: llm + id: 1762339969303-source-llm-target + selected: false + source: '1762339969303' + sourceHandle: source + target: llm + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: if-else + targetType: tool + id: 1762396405192-true-1762396707530-target + selected: false + source: '1762396405192' + sourceHandle: 'true' + target: '1762396707530' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: variable-aggregator + targetType: llm + id: 1762396843604-source-llm-target + selected: false + source: '1762396843604' + sourceHandle: source + target: llm + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: tool + targetType: iteration + id: 1762396707530-source-1762397735029-target + selected: false + source: '1762396707530' + sourceHandle: source + target: '1762397735029' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: true + isInLoop: false + iteration_id: '1762397735029' + sourceType: iteration-start + targetType: template-transform + id: 1762397735029start-source-1762397750136-target + selected: false + source: 1762397735029start + sourceHandle: source + target: '1762397750136' + targetHandle: target + type: custom + zIndex: 1002 + - data: + isInIteration: false + isInLoop: false + sourceType: iteration + targetType: code + id: 1762397735029-source-1762397785764-target + selected: false + source: '1762397735029' + sourceHandle: source + target: '1762397785764' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: code + targetType: variable-aggregator + id: 1762397785764-source-1762396843604-target + selected: false + source: '1762397785764' + sourceHandle: source + target: '1762396843604' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: start + targetType: if-else + id: 1762339910800-source-1762396405192-target + selected: false + source: '1762339910800' + sourceHandle: source + target: '1762396405192' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: if-else + targetType: code + id: 1762396405192-false-1762412240747-target + selected: false + source: '1762396405192' + sourceHandle: 'false' + target: '1762412240747' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: code + targetType: variable-aggregator + id: 1762412240747-source-1762396843604-target + selected: false + source: '1762412240747' + sourceHandle: source + target: '1762396843604' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: start + targetType: if-else + id: 1762339910800-source-1762421892949-target + selected: false + source: '1762339910800' + sourceHandle: source + target: '1762421892949' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: if-else + targetType: assigner + id: 1762421892949-false-1762509024795-target + selected: false + source: '1762421892949' + sourceHandle: 'false' + target: '1762509024795' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: code + targetType: iteration + id: 1762510470105-source-1762339969303-target + source: '1762510470105' + sourceHandle: source + target: '1762339969303' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInIteration: false + isInLoop: false + sourceType: if-else + targetType: tool + id: 1762421892949-true-1762511001734-target + source: '1762421892949' + sourceHandle: 'true' + target: '1762511001734' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: assigner + targetType: tool + id: 1762509024795-source-1762511001734-target + source: '1762509024795' + sourceHandle: source + target: '1762511001734' + targetHandle: target + type: custom + zIndex: 0 + - data: + isInLoop: false + sourceType: tool + targetType: code + id: 1762511001734-source-1762510470105-target + source: '1762511001734' + sourceHandle: source + target: '1762510470105' + targetHandle: target + type: custom + zIndex: 0 + nodes: + - data: + selected: false + title: 开始 + type: start + variables: + - default: '0' + hint: '' + label: 联网 + max_length: 48 + options: [] + placeholder: '' + required: true + type: number + variable: connectInternet + - default: '' + hint: '' + label: datasets + max_length: 256 + options: [] + placeholder: '' + required: true + type: text-input + variable: datasets + height: 114 + id: '1762339910800' + position: + x: -1233.1402302396395 + y: 149.5782401176896 + positionAbsolute: + x: -1233.1402302396395 + y: 149.5782401176896 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + context: + enabled: true + variable_selector: + - '1762510470105' + - result + memory: + query_prompt_template: '{{#sys.query#}} + + + {{#sys.files#}}' + role_prefix: + assistant: '' + user: '' + window: + enabled: false + size: 10 + model: + completion_params: {} + mode: chat + name: deepseek-ai/DeepSeek-V3 + provider: langgenius/siliconflow/siliconflow + prompt_config: + jinja2_variables: + - value_selector: + - '1762396843604' + - output + variable: searchData + - value_selector: + - '1762339969303' + - output + variable: fileData + - value_selector: + - '1762510470105' + - result + variable: result + prompt_template: + - edition_type: jinja2 + id: 5d50499d-b81d-43aa-a891-38fd349bd754 + jinja2_text: "你是一个专业的思政学习助手,致力于帮助用户学习思想政治理论知识。请基于提供的知识库内容{{ result }},为用户提供准确、简洁的回答。\r\ + \n\r\n{% if searchData %}\r\n结合 {{ searchData }} 回答用户\r\n{% endif %}\r\ + \n{% if fileData %}\r\n结合文件内容 {{ fileData }} 回答用户\r\n{% endif %}\r\n" + role: system + text: '你是一个专业的思政学习助手,致力于帮助用户学习思想政治理论知识。请基于提供的知识库内容,为用户提供准确、简洁的回答。 + + {% if {{#1762396843604.output#}} %} + + 结合联网内容{{#1762396843604.output#}} + + {% endif %} + + + {% if {{#1762339969303.output#}} %} + + 如果{{#1762339969303.output#}}不为空,根据里面的内容回答用户问题 + + {% endif %}' + - id: 23264213-e421-4449-b666-a55a0e39e561 + role: user + text: '' + selected: false + title: LLM + type: llm + vision: + enabled: false + height: 88 + id: llm + position: + x: 2674.6343495125943 + y: 75.75635633814841 + positionAbsolute: + x: 2674.6343495125943 + y: 75.75635633814841 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + answer: '{{#llm.text#}}' + selected: false + title: 直接回复 + type: answer + variables: [] + height: 103 + id: answer + position: + x: 3018 + y: 69 + positionAbsolute: + x: 3018 + y: 69 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + error_handle_mode: terminated + height: 212 + is_parallel: false + iterator_input_type: array[file] + iterator_selector: + - sys + - files + output_selector: + - '1762339981310' + - text + output_type: array[string] + parallel_nums: 10 + selected: false + start_node_id: 1762339969303start + title: 迭代 + type: iteration + width: 486 + height: 212 + id: '1762339969303' + position: + x: 648.8720188000339 + y: -65.6399059998305 + positionAbsolute: + x: 648.8720188000339 + y: -65.6399059998305 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 486 + zIndex: 1 + - data: + desc: '' + isInIteration: true + selected: false + title: '' + type: iteration-start + draggable: false + height: 48 + id: 1762339969303start + parentId: '1762339969303' + position: + x: 60 + y: 82 + positionAbsolute: + x: 708.8720188000339 + y: 16.360094000169497 + selectable: false + sourcePosition: right + targetPosition: left + type: custom-iteration-start + width: 44 + zIndex: 1002 + - data: + isInIteration: true + isInLoop: false + is_array_file: false + iteration_id: '1762339969303' + selected: false + title: 文档提取器 + type: document-extractor + variable_selector: + - '1762339969303' + - item + height: 92 + id: '1762339981310' + parentId: '1762339969303' + position: + x: 184 + y: 60 + positionAbsolute: + x: 832.8720188000339 + y: -5.6399059998305034 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + zIndex: 1002 + - data: + cases: + - case_id: 'true' + conditions: + - comparison_operator: '=' + id: aa1dcc3b-e7dc-42a6-83bc-1e7642061291 + value: '1' + varType: number + variable_selector: + - '1762339910800' + - connectInternet + id: 'true' + logical_operator: and + selected: false + title: 条件分支 + type: if-else + height: 124 + id: '1762396405192' + position: + x: 362 + y: 244 + positionAbsolute: + x: 362 + y: 244 + 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: Search content + ja_JP: Search content + pt_BR: Search content + zh_Hans: 检索内容 + label: + en_US: Search content + ja_JP: Search content + pt_BR: Search content + zh_Hans: 检索内容 + llm_description: Search content + max: null + min: null + name: query + options: [] + placeholder: null + precision: null + required: true + scope: null + template: null + type: string + - auto_generate: null + default: 10 + form: llm + human_description: + en_US: Result number control + ja_JP: Result number control + pt_BR: Result number control + zh_Hans: 结果条数控制(示例值:10/20/30/40/50) + label: + en_US: Response number + ja_JP: Response number + pt_BR: Response number + zh_Hans: 结果条数控制 + llm_description: Result number control + max: 50 + min: 10 + name: top_k + options: [] + placeholder: null + precision: null + required: false + scope: null + template: null + type: number + - auto_generate: null + default: null + form: llm + human_description: + en_US: Search the specified website + ja_JP: Search the specified website + pt_BR: Search the specified website + zh_Hans: 指定网站搜索 + label: + en_US: Search the specified website + ja_JP: Search the specified website + pt_BR: Search the specified website + zh_Hans: 指定网站搜索 + llm_description: Search the specified website + max: null + min: null + name: Insite + options: [] + placeholder: null + precision: null + required: false + scope: null + template: null + type: string + - auto_generate: null + default: null + form: llm + human_description: + en_US: Start time(eg:2025-01-01 00:00:00) + ja_JP: Start time(eg:2025-01-01 00:00:00) + pt_BR: Start time + zh_Hans: 起始时间(示例值:2025-01-01 00:00:00) + label: + en_US: Start time(eg:2025-01-01 00:00:00) + ja_JP: Start time(eg:2025-01-01 00:00:00) + pt_BR: Start time + zh_Hans: 起始时间(示例值:2025-01-01 00:00:00) + llm_description: Start time + max: null + min: null + name: FromTime + options: [] + placeholder: null + precision: null + required: false + scope: null + template: null + type: string + - auto_generate: null + default: null + form: llm + human_description: + en_US: End time(eg:2025-01-01 00:00:00) + ja_JP: End time(eg:2025-01-01 00:00:00) + pt_BR: End time + zh_Hans: 结束时间(示例值:2025-01-01 00:00:00) + label: + en_US: End time(eg:2025-01-01 00:00:00) + ja_JP: End time(eg:2025-01-01 00:00:00) + pt_BR: End time + zh_Hans: 结束时间(示例值:2025-01-01 00:00:00) + llm_description: End time + max: null + min: null + name: ToTime + options: [] + placeholder: null + precision: null + required: false + scope: null + template: null + type: string + params: + FromTime: '' + Insite: '' + ToTime: '' + query: '' + top_k: '' + provider_id: anspire/anspire_search/anspire_search + provider_name: anspire/anspire_search/anspire_search + provider_type: builtin + selected: false + title: 安思派联网搜索 + tool_configurations: {} + tool_description: 安思派联网搜索插件面向AI的下一代实时智能搜索引擎,为您的应用提供格式友好的多渠道全网内容。 + tool_label: 安思派联网搜索 + tool_name: anspire_search + tool_node_version: '2' + tool_parameters: + FromTime: + type: mixed + value: null + Insite: + type: mixed + value: null + ToTime: + type: mixed + value: null + query: + type: mixed + value: '{{#sys.query#}}' + top_k: + type: constant + value: 10 + type: tool + height: 52 + id: '1762396707530' + position: + x: 712.5714285714286 + y: 282 + positionAbsolute: + x: 712.5714285714286 + y: 282 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + advanced_settings: + group_enabled: false + groups: + - groupId: e4025d1c-dcac-4e35-98e6-b6f8a590d8f7 + group_name: Group1 + output_type: string + variables: + - - '1762397785764' + - result + output_type: string + selected: false + title: 搜索结果 + type: variable-aggregator + variables: + - - '1762397785764' + - result + - - '1762412240747' + - result + height: 134 + id: '1762396843604' + position: + x: 2014 + y: 282 + positionAbsolute: + x: 2014 + y: 282 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + error_handle_mode: terminated + height: 172 + is_parallel: false + iterator_input_type: array[object] + iterator_selector: + - '1762396707530' + - json + output_selector: + - '1762397750136' + - output + output_type: array[string] + parallel_nums: 10 + selected: false + start_node_id: 1762397735029start + title: 搜索结果处理 + type: iteration + width: 486 + height: 172 + id: '1762397735029' + position: + x: 1057.795011750021 + y: 141.745129250233 + positionAbsolute: + x: 1057.795011750021 + y: 141.745129250233 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 486 + zIndex: 1 + - data: + desc: '' + isInIteration: true + selected: false + title: '' + type: iteration-start + draggable: false + height: 48 + id: 1762397735029start + parentId: '1762397735029' + position: + x: 60 + y: 62 + positionAbsolute: + x: 1117.795011750021 + y: 203.745129250233 + selectable: false + sourcePosition: right + targetPosition: left + type: custom-iteration-start + width: 44 + zIndex: 1002 + - data: + isInIteration: true + isInLoop: false + iteration_id: '1762397735029' + selected: false + template: '联网搜索对象如下:title:{{ item.title }}, date: {{item.date}}, content: + {{item.content}}, url: {{item.url}}' + title: 模板转换 + type: template-transform + variables: + - value_selector: + - '1762397735029' + - item + value_type: object + variable: item + height: 52 + id: '1762397750136' + parentId: '1762397735029' + position: + x: 184 + y: 60 + positionAbsolute: + x: 1241.795011750021 + y: 201.745129250233 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + zIndex: 1002 + - data: + code: "\ndef main(arg1: list[str]):\n return {\n \"result\": \"\ + \ \\n \".join(arg1),\n }\n" + code_language: python3 + outputs: + result: + children: null + type: string + selected: false + title: 搜索结果拼接字符串 + type: code + variables: + - value_selector: + - '1762397735029' + - output + value_type: array[string] + variable: arg1 + height: 52 + id: '1762397785764' + position: + x: 1654.857142857143 + y: 232 + positionAbsolute: + x: 1654.857142857143 + y: 232 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + code: "\ndef main():\n return {\n \"result\": '',\n }\n" + code_language: python3 + outputs: + result: + children: null + type: string + selected: false + title: 代码执行 2 + type: code + variables: [] + height: 52 + id: '1762412240747' + position: + x: 1203.2297259201623 + y: 455.04988249978817 + positionAbsolute: + x: 1203.2297259201623 + y: 455.04988249978817 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + cases: + - case_id: 'true' + conditions: + - comparison_operator: not empty + id: db262070-ee0c-48c5-bbe7-413aba217fe3 + value: '' + varType: array[object] + variable_selector: + - conversation + - datasets + id: 'true' + logical_operator: and + selected: false + title: 条件分支 2 + type: if-else + height: 124 + id: '1762421892949' + position: + x: -574.0020544748936 + y: -119.81865777003897 + positionAbsolute: + x: -574.0020544748936 + y: -119.81865777003897 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + items: + - input_type: variable + operation: over-write + value: + - '1762339910800' + - datasets + variable_selector: + - conversation + - datasets + write_mode: over-write + selected: false + title: 变量赋值 + type: assigner + version: '2' + height: 84 + id: '1762509024795' + position: + x: -264.17080706957324 + y: -12.151733105069425 + positionAbsolute: + x: -264.17080706957324 + y: -12.151733105069425 + selected: false + sourcePosition: right + targetPosition: left + type: custom + width: 242 + - data: + code: "\nimport json\ndef main(text: str):\n segments = json.loads(json.loads(text)[\"\ + output\"])\n \n# 如果为空,返回空字符串\n if not segments or len(segments) ==\ + \ 0:\n return {\n \"result\": \"\"\n }\n \n\ + \ # 提取每个记录的content字段(实际文本内容)\n contents = []\n for record in segments:\n\ + \ # 检索结果中的segment字段包含实际内容\n if isinstance(record, dict):\n\ + \ # 尝试获取segment.content\n if 'segment' in record and\ + \ 'content' in record['segment']:\n contents.append(record['segment']['content'])\n\ + \ # 或者直接content字段\n elif 'content' in record:\n \ + \ contents.append(record['content'])\n \n # 将所有内容合并为一个字符串,用换行符分隔\n\ + \ result_text = \"\\n\\n---\\n\\n\".join(contents)\n\n return {\n\ + \ \"result\": result_text,\n }\n" + code_language: python3 + outputs: + result: + children: null + type: string + selected: false + title: 知识库结果处理 + type: code + variables: + - value_selector: + - '1762511001734' + - text + value_type: string + variable: text + height: 52 + id: '1762510470105' + position: + x: 160.3708886896208 + y: -129.73029023737095 + positionAbsolute: + x: 160.3708886896208 + y: -129.73029023737095 + 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 + params: + dataset_ids: '' + query: '' + provider_id: 019a5dd7-5f2b-7767-b2df-82bfda84c7ec + 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_ids: + type: mixed + value: '{{#conversation.datasets#}}' + query: + type: mixed + value: '{{#sys.query#}}' + type: tool + height: 52 + id: '1762511001734' + position: + x: -142.91348174874167 + y: -247.51043561574136 + positionAbsolute: + x: -142.91348174874167 + y: -247.51043561574136 + selected: true + sourcePosition: right + targetPosition: left + type: custom + width: 242 + viewport: + x: 863.6452676587132 + y: 446.19950772630614 + zoom: 0.9236555375410279 + rag_pipeline_variables: [] diff --git a/docker/schoolNews/dify/部署注意点.md b/docker/schoolNews/dify/部署注意点.md new file mode 100644 index 0000000..9c2ac1b --- /dev/null +++ b/docker/schoolNews/dify/部署注意点.md @@ -0,0 +1,9 @@ +# 1.工作流修改 +## 动态知识库检索工作流 +修改dataset的apikey + +## 思政小帮手对话流 +修改“动态知识库检索”的入参 + +# 2. 后端修改 +修改yaml的配置内容 \ No newline at end of file