diff --git a/conversion.log b/conversion.log new file mode 100644 index 00000000..d8a08540 --- /dev/null +++ b/conversion.log @@ -0,0 +1,3 @@ +2025-03-31 11:58:54,955 - md-to-mdx - INFO - 处理文件: zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik.md +2025-03-31 11:58:54,964 - md-to-mdx - INFO - 转换完成: zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik.mdx +2025-03-31 11:58:54,964 - md-to-mdx - INFO - 已删除源文件: zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik.md diff --git a/docs.json b/docs.json index d1125c6d..623e581d 100644 --- a/docs.json +++ b/docs.json @@ -510,7 +510,8 @@ { "group": "工作流", "pages": [ - "zh-hans/guides/workflow/concepts", + "zh-hans/guides/workflow/readme", + "zh-hans/guides/workflow/key-concept", "zh-hans/guides/workflow/variables", { "group": "节点说明", @@ -543,7 +544,7 @@ "group": "异常处理", "pages": [ "zh-hans/guides/workflow/error-handling/readme", - "zh-hans/guides/workflow/error-handling/predefined-node-failure-logic", + "zh-hans/guides/workflow/error-handling/predefined-nodes-failure-logic", "zh-hans/guides/workflow/error-handling/error-type" ] }, @@ -558,7 +559,7 @@ "zh-hans/guides/workflow/debug-and-preview/history" ] }, - "zh-hans/guides/workflow/application-publishing", + "zh-hans/guides/workflow/publish", "zh-hans/guides/workflow/bulletin" ] }, @@ -593,16 +594,44 @@ "zh-hans/guides/knowledge-base/metadata", "zh-hans/guides/knowledge-base/integrate-knowledge-within-application", "zh-hans/guides/knowledge-base/retrieval-test-and-citation", + "zh-hans/guides/knowledge-base/knowledge-request-rate-limit", "zh-hans/guides/knowledge-base/connect-external-knowledge-base", "zh-hans/guides/knowledge-base/api-documentation/external-knowledge-api-documentation" ] - }, + }, + { + "group": "工具", + "pages": [ + "zh-hans/guides/tools/readme", + "zh-hans/guides/tools/quick-tool-integration", + "zh-hans/guides/tools/advanced-tool-integration", + "zh-hans/guides/tools/tool-configuration/readme", + { + "group": "工具配置详情", + "pages": [ + "zh-hans/guides/tools/tool-configuration/google", + "zh-hans/guides/tools/tool-configuration/bing", + "zh-hans/guides/tools/tool-configuration/searchapi", + "zh-hans/guides/tools/tool-configuration/stable-diffusion", + "zh-hans/guides/tools/tool-configuration/dall-e", + "zh-hans/guides/tools/tool-configuration/perplexity", + "zh-hans/guides/tools/tool-configuration/alphavantage", + "zh-hans/guides/tools/tool-configuration/youtube", + "zh-hans/guides/tools/tool-configuration/searxng", + "zh-hans/guides/tools/tool-configuration/serper", + "zh-hans/guides/tools/tool-configuration/siliconflow", + "zh-hans/guides/tools/tool-configuration/comfyui" + ] + } + ] + }, { "group": "发布", "pages": [ { "group": "发布为公开 Web 站点", "pages": [ + "zh-hans/guides/application-publishing/launch-your-webapp-quickly/readme", "zh-hans/guides/application-publishing/launch-your-webapp-quickly/web-app-settings", "zh-hans/guides/application-publishing/launch-your-webapp-quickly/text-generator", "zh-hans/guides/application-publishing/launch-your-webapp-quickly/conversation-application" @@ -623,11 +652,14 @@ { "group": "监测", "pages": [ + "zh-hans/guides/monitoring/README", { "group": "集成外部与 Ops 工具", "pages": [ + "zh-hans/guides/monitoring/integrate-external-ops-tools/readme", "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-langfuse", - "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-langsmith" + "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-langsmith", + "zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik" ] }, "zh-hans/guides/monitoring/analysis" @@ -636,6 +668,7 @@ { "group": "扩展", "pages": [ + "zh-hans/guides/tools/extensions/README", { "group": "API 扩展", "pages": [ @@ -657,6 +690,7 @@ { "group": "协同", "pages": [ + "zh-hans/guides/workspace/readme", "zh-hans/guides/workspace/app", "zh-hans/guides/workspace/invite-and-manage-members" ] @@ -1343,6 +1377,190 @@ ] }, "redirects": [ + { + "source": "zh-hans/getting-started/install-self-hosted", + "destination": "zh-hans/getting-started/install-self-hosted/readme" + }, + { + "source": "zh-hans/guides/model-configuration", + "destination": "zh-hans/guides/model-configuration/readme" + }, + { + "source": "zh-hans/guides/application-orchestrate", + "destination": "zh-hans/guides/application-orchestrate/readme" + }, + { + "source": "zh-hans/guides/application-orchestrate/app-toolkits", + "destination": "zh-hans/guides/application-orchestrate/app-toolkits/readme" + }, + { + "source": "zh-hans/guides/workflow", + "destination": "zh-hans/guides/workflow/readme" + }, + { + "source": "zh-hans/guides/workflow/node", + "destination": "zh-hans/guides/workflow/node/start" + }, + { + "source": "zh-hans/guides/workflow/error-handling", + "destination": "zh-hans/guides/workflow/error-handling/readme" + }, + { + "source": "zh-hans/guides/workflow/debug-and-preview", + "destination": "zh-hans/guides/workflow/debug-and-preview/preview-and-run" + }, + { + "source": "zh-hans/guides/workflow/debug-and-preview/yu-lan-yu-yun-hang", + "destination": "zh-hans/guides/workflow/debug-and-preview/preview-and-run" + }, + { + "source": "zh-hans/guides/knowledge-base", + "destination": "zh-hans/guides/knowledge-base/readme" + }, + { + "source": "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents", + "destination": "zh-hans/guides/knowledge-base/knowledge-base-creation/introduction" + }, + { + "source": "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents/import-content-data", + "destination": "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents/import-content-data/readme" + }, + { + "source": "zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance", + "destination": "zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance/introduction" + }, + { + "source": "zh-hans/guides/tools", + "destination": "zh-hans/guides/tools/readme" + }, + { + "source": "zh-hans/guides/tools/tool-configuration", + "destination": "zh-hans/guides/tools/tool-configuration/readme" + }, + { + "source": "zh-hans/guides/application-publishing", + "destination": "zh-hans/guides/application-publishing/readme" + }, + { + "source": "zh-hans/guides/application-publishing/launch-your-webapp-quickly", + "destination": "zh-hans/guides/application-publishing/launch-your-webapp-quickly/readme" + }, + { + "source": "zh-hans/guides/annotation", + "destination": "zh-hans/guides/annotation/readme" + }, + { + "source": "zh-hans/guides/monitoring", + "destination": "zh-hans/guides/monitoring/readme" + }, + { + "source": "zh-hans/guides/monitoring/integrate-external-ops-tools", + "destination": "zh-hans/guides/monitoring/integrate-external-ops-tools/readme" + }, + { + "source": "zh-hans/guides/extension", + "destination": "zh-hans/guides/extension/readme" + }, + { + "source": "zh-hans/guides/extension/api-based-extension", + "destination": "zh-hans/guides/extension/api-based-extension/readme" + }, + { + "source": "zh-hans/guides/extension/code-based-extension", + "destination": "zh-hans/guides/extension/code-based-extension/readme" + }, + { + "source": "zh-hans/guides/workspace", + "destination": "zh-hans/guides/workspace/readme" + }, + { + "source": "zh-hans/guides/management", + "destination": "zh-hans/guides/management/readme" + }, + { + "source": "zh-hans/workshop/basic", + "destination": "zh-hans/workshop/readme" + }, + { + "source": "zh-hans/workshop/intermediate", + "destination": "zh-hans/workshop/intermediate/readme" + }, + { + "source": "zh-hans/plugins/quick-start", + "destination": "zh-hans/plugins/quick-start/readme" + }, + { + "source": "zh-hans/plugins/quick-start/develop-plugins", + "destination": "zh-hans/plugins/quick-start/develop-plugins/readme" + }, + { + "source": "zh-hans/plugins/quick-start/develop-plugins/model-plugin", + "destination": "zh-hans/plugins/quick-start/develop-plugins/model-plugin/readme" + }, + { + "source": "zh-hans/plugins/schema-definition", + "destination": "zh-hans/plugins/schema-definition/readme" + }, + { + "source": "zh-hans/plugins/schema-definition/model", + "destination": "zh-hans/plugins/schema-definition/model/readme" + }, + { + "source": "zh-hans/plugins/schema-definition/reverse-invocation-of-the-dify-service", + "destination": "zh-hans/plugins/schema-definition/reverse-invocation-of-the-dify-service/readme" + }, + { + "source": "zh-hans/plugins/best-practice", + "destination": "zh-hans/plugins/best-practice/develop-a-slack-bot-plugin" + }, + { + "source": "zh-hans/plugins/publish-plugins", + "destination": "zh-hans/plugins/publish-plugins/README" + }, + { + "source": "zh-hans/plugins/publish-plugins/publish-to-dify-marketplace", + "destination": "zh-hans/plugins/publish-plugins/publish-to-dify-marketplace/README" + }, + { + "source": "zh-hans/development/backend", + "destination": "zh-hans/development/backend/readme" + }, + { + "source": "zh-hans/development/backend/sandbox", + "destination": "zh-hans/development/backend/sandbox/readme" + }, + { + "source": "zh-hans/development/models-integration", + "destination": "zh-hans/development/models-integration/readme" + }, + { + "source": "zh-hans/development/migration", + "destination": "zh-hans/development/migration/readme" + }, + { + "source": "zh-hans/learn-more/use-cases", + "destination": "zh-hans/learn-more/use-cases/readme" + }, + { + "source": "zh-hans/learn-more/extended-reading", + "destination": "zh-hans/learn-more/extended-reading/readme" + }, + { + "source": "zh-hans/learn-more/extended-reading/retrieval-augment", + "destination": "zh-hans/learn-more/extended-reading/retrieval-augment/readme" + }, + { + "source": "zh-hans/learn-more/faq", + "destination": "zh-hans/learn-more/faq/readme" + }, + { + "source": "zh-hans/policies/agreement", + "destination": "zh-hans/policies/agreement/readme" + }, + { + "source": "/zh-hans", + "destination": "/zh-hans/introduction" + }, { "source": "/introduction", "destination": "/en/introduction" diff --git a/output/readme_redirects_zh-hans.json b/output/readme_redirects_zh-hans.json new file mode 100644 index 00000000..880725a9 --- /dev/null +++ b/output/readme_redirects_zh-hans.json @@ -0,0 +1,182 @@ +[ + { + "source": "zh-hans/getting-started/install-self-hosted", + "destination": "zh-hans/getting-started/install-self-hosted/readme" + }, + { + "source": "zh-hans/guides/model-configuration", + "destination": "zh-hans/guides/model-configuration/readme" + }, + { + "source": "zh-hans/guides/application-orchestrate", + "destination": "zh-hans/guides/application-orchestrate/readme" + }, + { + "source": "zh-hans/guides/application-orchestrate/app-toolkits", + "destination": "zh-hans/guides/application-orchestrate/app-toolkits/readme" + }, + { + "source": "zh-hans/guides/workflow", + "destination": "zh-hans/guides/workflow/readme" + }, + { + "source": "zh-hans/guides/workflow/node", + "destination": "zh-hans/guides/workflow/node/start" + }, + { + "source": "zh-hans/guides/workflow/error-handling", + "destination": "zh-hans/guides/workflow/error-handling/readme" + }, + { + "source": "zh-hans/guides/workflow/debug-and-preview", + "destination": "zh-hans/guides/workflow/debug-and-preview/preview-and-run" + }, + { + "source": "zh-hans/guides/workflow/debug-and-preview/yu-lan-yu-yun-hang", + "destination": "zh-hans/guides/workflow/debug-and-preview/preview-and-run" + }, + { + "source": "zh-hans/guides/knowledge-base", + "destination": "zh-hans/guides/knowledge-base/readme" + }, + { + "source": "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents", + "destination": "zh-hans/guides/knowledge-base/knowledge-base-creation/introduction" + }, + { + "source": "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents/import-content-data", + "destination": "zh-hans/guides/knowledge-base/create-knowledge-and-upload-documents/import-content-data/readme" + }, + { + "source": "zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance", + "destination": "zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance/introduction" + }, + { + "source": "zh-hans/guides/tools", + "destination": "zh-hans/guides/tools/readme" + }, + { + "source": "zh-hans/guides/tools/tool-configuration", + "destination": "zh-hans/guides/tools/tool-configuration/readme" + }, + { + "source": "zh-hans/guides/application-publishing", + "destination": "zh-hans/guides/application-publishing/readme" + }, + { + "source": "zh-hans/guides/application-publishing/launch-your-webapp-quickly", + "destination": "zh-hans/guides/application-publishing/launch-your-webapp-quickly/readme" + }, + { + "source": "zh-hans/guides/annotation", + "destination": "zh-hans/guides/annotation/readme" + }, + { + "source": "zh-hans/guides/monitoring", + "destination": "zh-hans/guides/monitoring/readme" + }, + { + "source": "zh-hans/guides/monitoring/integrate-external-ops-tools", + "destination": "zh-hans/guides/monitoring/integrate-external-ops-tools/readme" + }, + { + "source": "zh-hans/guides/extension", + "destination": "zh-hans/guides/extension/readme" + }, + { + "source": "zh-hans/guides/extension/api-based-extension", + "destination": "zh-hans/guides/extension/api-based-extension/readme" + }, + { + "source": "zh-hans/guides/extension/code-based-extension", + "destination": "zh-hans/guides/extension/code-based-extension/readme" + }, + { + "source": "zh-hans/guides/workspace", + "destination": "zh-hans/guides/workspace/readme" + }, + { + "source": "zh-hans/guides/management", + "destination": "zh-hans/guides/management/readme" + }, + { + "source": "zh-hans/workshop/basic", + "destination": "zh-hans/workshop/readme" + }, + { + "source": "zh-hans/workshop/intermediate", + "destination": "zh-hans/workshop/intermediate/readme" + }, + { + "source": "zh-hans/plugins/quick-start", + "destination": "zh-hans/plugins/quick-start/readme" + }, + { + "source": "zh-hans/plugins/quick-start/develop-plugins", + "destination": "zh-hans/plugins/quick-start/develop-plugins/readme" + }, + { + "source": "zh-hans/plugins/quick-start/develop-plugins/model-plugin", + "destination": "zh-hans/plugins/quick-start/develop-plugins/model-plugin/readme" + }, + { + "source": "zh-hans/plugins/schema-definition", + "destination": "zh-hans/plugins/schema-definition/readme" + }, + { + "source": "zh-hans/plugins/schema-definition/model", + "destination": "zh-hans/plugins/schema-definition/model/readme" + }, + { + "source": "zh-hans/plugins/schema-definition/reverse-invocation-of-the-dify-service", + "destination": "zh-hans/plugins/schema-definition/reverse-invocation-of-the-dify-service/readme" + }, + { + "source": "zh-hans/plugins/best-practice", + "destination": "zh-hans/plugins/best-practice/develop-a-slack-bot-plugin" + }, + { + "source": "zh-hans/plugins/publish-plugins", + "destination": "zh-hans/plugins/publish-plugins/README" + }, + { + "source": "zh-hans/plugins/publish-plugins/publish-to-dify-marketplace", + "destination": "zh-hans/plugins/publish-plugins/publish-to-dify-marketplace/README" + }, + { + "source": "zh-hans/development/backend", + "destination": "zh-hans/development/backend/readme" + }, + { + "source": "zh-hans/development/backend/sandbox", + "destination": "zh-hans/development/backend/sandbox/readme" + }, + { + "source": "zh-hans/development/models-integration", + "destination": "zh-hans/development/models-integration/readme" + }, + { + "source": "zh-hans/development/migration", + "destination": "zh-hans/development/migration/readme" + }, + { + "source": "zh-hans/learn-more/use-cases", + "destination": "zh-hans/learn-more/use-cases/readme" + }, + { + "source": "zh-hans/learn-more/extended-reading", + "destination": "zh-hans/learn-more/extended-reading/readme" + }, + { + "source": "zh-hans/learn-more/extended-reading/retrieval-augment", + "destination": "zh-hans/learn-more/extended-reading/retrieval-augment/readme" + }, + { + "source": "zh-hans/learn-more/faq", + "destination": "zh-hans/learn-more/faq/readme" + }, + { + "source": "zh-hans/policies/agreement", + "destination": "zh-hans/policies/agreement/readme" + } +] \ No newline at end of file diff --git a/zh-hans/guides/application-publishing/launch-your-webapp-quickly/readme.mdx b/zh-hans/guides/application-publishing/launch-your-webapp-quickly/readme.mdx new file mode 100644 index 00000000..1ec9fc7d --- /dev/null +++ b/zh-hans/guides/application-publishing/launch-your-webapp-quickly/readme.mdx @@ -0,0 +1,39 @@ +--- +title: 发布为公开 Web 站点 +--- + +使用 Dify 创建 AI 应用的一个好处在于,你可以在几分钟内就发布一个可供用户在互联网上公开访问的 Web 应用,该应用将根据你的 Prompt 和编排设置进行工作。 + +* 如果你使用的是自部署的开源版,该应用将运行在你的服务器上 +* 如果你使用的是云服务,该应用将托管至网址 [https://udify.app/](https://udify.app/) + +*** + +### 发布 AI 站点 + +在应用监测页中,你可以找到 WebApp 的管理卡片。打开访问开关后,你可以得到一个能够在互联网上公开分享的网址。 + +![](https://assets-docs.dify.ai/2025/03/40a972bc270777a3bedd1b2bc5d34114.png) + +我们对以下两种应用类型均预置了漂亮的 WebApp 界面: + +* 文本生成型([前往预览](./text-generator)) +* 对话型([前往预览](./conversation-application)) + +*** + +### 设置你的 AI 站点 + +点击 WebApp 卡片上的**设置**按钮,为 AI 站点配置一些选项,它们都会被最终用户所见: + +![](https://assets-docs.dify.ai/2025/03/40a972bc270777a3bedd1b2bc5d34114.png) + + +界面语言目前已支持:英文,中文,繁体中文,葡萄牙语,德语,日本语,韩语,乌克兰语,越南语。如果你需要增加更多语言,可以在 GitHub 内提交 Issue[ 寻求支持](/zh-hans/community/support)或者提交 PR 贡献代码。 + + +*** + +### 嵌入你的 AI 站点 + +除了将应用发布为一个公开的 AI 网站,你还可以将它嵌入并集成至你的网站、博客或其它任意网页中。详细说明请参考 [《嵌入网站》](/zh-hans/guides/application-publishing/embedding-in-websites)。 diff --git a/zh-hans/guides/knowledge-base/connect-external-knowledge-base.mdx.bak b/zh-hans/guides/knowledge-base/connect-external-knowledge-base.mdx.bak deleted file mode 100644 index 89ecfcfc..00000000 --- a/zh-hans/guides/knowledge-base/connect-external-knowledge-base.mdx.bak +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: 连接外部知识库 -version: '简体中文' ---- - -> 为做出区别,独立于 Dify 平台之外的知识库在本文内均被统称为 **“外部知识库”** 。 - -## 功能简介 - -对于内容检索有着更高要求的进阶开发者而言,Dify 平台内置的知识库功能和文本检索和召回机制**存在限制,无法轻易变更文本召回结果。** - -出于对文本检索和召回的精确度有着更高追求,以及对内部资料的管理需求,部分团队选择自主研发 RAG 算法并独立维护文本召回系统、或将内容统一托管至云厂商的知识库服务(例如 [AWS Bedrock](https://aws.amazon.com/bedrock/))。 - -作为中立的 LLM 应用开发平台,Dify 致力于给予开发者更多选择权。 - -**连接外部知识库**功能可以将 Dify 平台与外部知识库建立连接。通过 API 服务,AI 应用能够获取更多信息来源。这意味着: - -* Dify 平台能够直接获取托管在云服务提供商知识库内的文本内容,开发者无需将内容重复搬运至 Dify 中的知识库; -* Dify 平台能够直接获取自建知识库内经算法处理后的文本内容,开发者仅需关注自建知识库的信息检索机制,并不断优化与提升信息召回的准确度。 - - - - - -以下是连接外部知识的详细步骤: - - - - 为了确保你的外部知识库与 Dify 连接成功,请在建立 API 服务前仔细阅读由 Dify 编写的[外部知识库 API 规范](../knowledge-and-documents-maintenance/maintain-dataset-via-api)。 - - - > 目前, Dify 连接外部知识库时仅具备检索权限,暂不支持对外部知识库进行优化与修改,开发者需自行维护外部知识库。 - - 前往 **“知识库”** 页,点击右上角的 **“外部知识库 API”**,轻点 **“添加外部知识库 API”**。 - - 按照页面提示,依次填写以下内容: - - * 知识库的名称,允许自定义名称,用于区分所连接的不同外部知识 API; - * API 接口地址,外部知识库的连接地址,示例 `api-endpoint/retrieval`;详细说明请参考[外部知识库 API](../knowledge-and-documents-maintenance/maintain-dataset-via-api); - * API Key,外部知识库连接密钥,详细说明请参考[外部知识库 API](../knowledge-and-documents-maintenance/maintain-dataset-via-api); - - - - - - - 前往 **“知识库”** 页,点击添加知识库卡片下方的 **“连接外部知识库”** 跳转至参数配置页面。 - - - - - - 填写以下参数: - - * **知识库名称与描述** - * **外部知识库 API** 选择在第二步中关联的外部知识库 API;Dify 将通过 API 连接的方式,调用存储在外部知识库的文本内容; - * **外部知识库 ID** 指定需要被关联的特定的外部知识库 ID,详细说明请参考[外部知识库 API](../knowledge-and-documents-maintenance/maintain-dataset-via-api)。 - * **调整召回设置** - - **Top K:** 用户发起提问时,将请求外部知识 API 获取相关性较高的内容分段。该参数用于筛选与用户问题相似度较高的文本片段。默认值为 3,数值越高,召回存在相关性的文本分段也就越多。 - - **Score 阈值:** 文本片段筛选的相似度阈值,只召回超过设置分数的文本片段,默认值为 0.5。数值越高说明对于文本与问题要求的相似度越高,预期被召回的文本数量也越少,结果也会相对而言更加精准。 - - - - - - - - 建立与外部知识库的连接后,开发者可以在 **“召回测试”** 中模拟可能的问题关键词,预览从外部知识库召回的文本分段。若对于召回结果不满意,可以尝试修改召回参数或自行调整外部知识库的检索设置。 - - - - - - - - **Chatbot / Agent 类型应用** - - 在 Chatbot / Agent 类型应用内的编排页中的 **“上下文”** 内,选中带有 `EXTERNAL` 标签的外部知识库。 - - - - - - - **Chatflow / Workflow 类型应用** - - 在 Chatflow / Workflow 类型应用内添加 **“知识检索”** 节点,选中带有 `EXTERNAL` 标签的外部知识库。 - - -
- - -
- - 在 **“知识库”** 页,外部知识库的卡片右上角会带有 **EXTERNAL** 标签。进入需要修改的知识库,点击 **“设置”** 修改以下内容: - - * **知识库名称和描述** - * **可见范围** 提供 「 只有我 」 、 「 所有团队成员 」 和 「部分团队成员」 三种权限范围。不具有权限的人将无法访问该知识库。若选择将知识库公开至其它成员,则意味着其它成员同样具备该知识库的查看、编辑和删除权限。 - * **召回设置** - - **Top K:** 用户发起提问时,将请求外部知识 API 获取相关性较高的内容分段。该参数用于筛选与用户问题相似度较高的文本片段。默认值为 3,数值越高,召回存在相关性的文本分段也就越多。 - - **Score 阈值:** 文本片段筛选的相似度阈值,只召回超过设置分数的文本片段,默认值为 0.5。数值越高说明对于文本与问题要求的相似度越高,预期被召回的文本数量也越少,结果也会相对而言更加精准。 - - 外部知识库所关联的 **“外部知识库 API”** 和 **“外部知识 ID”** 不支持修改,如需修改请关联新的 “外部知识库 API” 并重新进行连接。 - -
- -## 连接示例 - -[如何连接 AWS Bedrock 知识库?](https://docs.dify.ai/zh-hans/learn-more/use-cases/how-to-connect-aws-bedrock) - -## 常见问题 - -**连接外部知识库 API 时异常,出现报错如何处理?** - -以下是返回信息各个错误码所对应的错误提示与解决办法: - -| 错误码 | 错误提示 | 解决办法 | -| ---- | --------------------------- | ------------------------------ | -| 1001 | 无效的 Authorization header 格式 | 请检查请求的 Authorization header 格式 | -| 1002 | 验证异常 | 请检查所填写的 API Key 是否正确 | -| 2001 | 知识库不存在 | 请检查外部知识库 | diff --git a/zh-hans/guides/knowledge-base/faq.mdx.bak b/zh-hans/guides/knowledge-base/faq.mdx.bak deleted file mode 100644 index 312df64e..00000000 --- a/zh-hans/guides/knowledge-base/faq.mdx.bak +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: 常见问题 -version: '简体中文' ---- - -## 1. 导入文档与查询响应速度缓慢,如何排查原因? - -通常情况下,上传文档后的 Embedding 过程将耗费大量资源,有可能造成速度缓慢。请检查服务器负载,将日志切换为 debug 模式或检查 Embedding 的返回时间。 - -## 2. 上传至知识库的文档内容较多,分段后内容异常,如何处理? - -请检查服务器负载的内存占用情况,查看是否出现内存泄漏问题。 - -## 3. 知识库的文件处理一直显示为“排队中”,如何处理? - -此问题有可能是由于与 redis 服务的连接中断,导致任务无法退出。建议重启 Worker 节点。 - -## 4. 如何优化应用对知识库内容的检索结果? - -你可以通过调整检索设置,比较不同的参数进行优化。具体操作请参考[检索设置](/zh-cn/user-guide/knowledge-base/knowledge-base-creation/upload-documents#3)。 diff --git a/zh-hans/guides/knowledge-base/integrate-knowledge-within-application.mdx.bak b/zh-hans/guides/knowledge-base/integrate-knowledge-within-application.mdx.bak deleted file mode 100644 index 9b21336f..00000000 --- a/zh-hans/guides/knowledge-base/integrate-knowledge-within-application.mdx.bak +++ /dev/null @@ -1,204 +0,0 @@ ---- -title: 在应用内集成知识库 -version: '简体中文' ---- - -知识库可以作为外部知识提供给大语言模型用于精确回复用户问题,你可以在 Dify 的[所有应用类型](https://docs.dify.ai/zh-hans/guides/application-orchestrate#application_type)内关联已创建的知识库。 - -以聊天助手为例,使用流程如下: - -1. 进入 **工作室 -- 创建应用 --创建聊天助手** -2. 进入 **上下文设置** 点击 **添加** 选择已创建的知识库 -3. 在 **上下文设置 -- 参数设置** 内配置**召回策略** -4. 在 **元数据筛选** 板块中配置元数据的筛选条件,使用元数据功能筛选知识库内的文档 -5. 在 **添加功能** 内打开 **引用和归属** -6. 在 **调试与预览** 内输入与知识库相关的用户问题进行调试 -7. 调试完成之后**保存并发布**为一个 AI 知识库问答类应用 - -*** - -### 关联知识库并指定召回模式 - -如果当前应用的上下文涉及多个知识库,需要设置召回模式以使得检索的内容更加精确。进入 **上下文 -- 参数设置 -- 召回设置**。 - -#### 召回设置 - -检索器会在所有与应用关联的知识库中去检索与用户问题相关的文本内容,并将多路召回的相关文档结果合并,以下是召回策略的技术流程图: - -![](https://assets-docs.dify.ai/2025/03/745b9de1cdd9465bfbad2ddc5f27bd12.png) - -根据用户意图同时检索所有添加至 **“上下文”** 的知识库,在多个知识库内查询相关文本片段,选择所有和用户问题相匹配的内容,最后通过 Rerank 策略找到最适合的内容并回答用户。该方法的检索原理更为科学。 - -![](https://assets-docs.dify.ai/2024/12/3e0c9be17f054d211c4385ab74d47dfb.png) - -举例:A 应用的上下文关联了 K1、K2、K3 三个知识库,当用户输入问题后,将在三个知识库内检索并汇总多条内容。为确保能找到最匹配的内容,需要通过 Rerank 策略确定与用户问题最相关的内容,确保结果更加精准与可信。 - -在实际问答场景中,每个知识库的内容来源和检索方式可能都有所差异。针对检索返回的多条混合内容,Rerank 策略是一个更加科学的内容排序机制。它可以帮助确认候选内容列表与用户问题的匹配度,改进多个知识间排序的结果以找到最匹配的内容,提高回答质量和用户体验。 - -考虑到 Rerank 的使用成本和业务需求,多路召回模式提供了以下两种 Rerank 设置: - -**权重设置** - -该设置无需配置外部 Rerank 模型,重排序内容**无需额外花费**。可以通过调整语义或关键词的权重比例条,选择最适合的内容匹配策略。 - -* **语义值为 1** - - 仅启用语义检索模式。借助 Embedding 模型,即便知识库中没有出现查询中的确切词汇,也能通过计算向量距离的方式提高搜索的深度,返回正确内容。此外,当需要处理多语言内容时,语义检索能够捕捉不同语言之间的意义转换,提供更加准确的跨语言搜索结果。 - - > 语义检索指的是比对用户问题与知识库内容中的向量距离。距离越近,匹配的概率越大。参考阅读:[《Dify:Embedding 技术与 Dify 数据集设计/规划》](https://mp.weixin.qq.com/s/vmY\_CUmETo2IpEBf1nEGLQ)。 -* **关键词值为 1** - - 仅启用关键词检索模式。通过用户输入的信息文本在知识库全文匹配,适用于用户知道确切的信息或术语的场景。该方法所消耗的计算资源较低,适合在大量文档的知识库内快速检索。 -* **自定义关键词和语义权重** - - 除了仅启用语义检索或关键词检索模式,我们还提供了灵活的自定义权重设置。你可以通过不断调试二者的权重,找到符合业务场景的最佳权重比例。 - -**Rerank 模型** - -Rerank 模型是一种外部评分系统,它会计算用户问题与给定的每个候选文档之间的相关性分数,从而改进语义排序的结果,并按相关性返回从高到低排序的文档列表。 - -虽然此方法会产生一定的额外花费,但是更加擅长处理知识库内容来源复杂的情况,例如混合了语义查询和关键词匹配的内容,或返回内容存在多语言的情况。 - -Dify 目前支持多个 Rerank 模型,进入 “模型供应商” 页填入 Rerank 模型(例如 Cohere、Jina AI 等模型)的 API Key。 - - - - - -**可调参数** - -* **TopK** - - 用于筛选与用户问题相似度最高的文本片段。系统同时会根据选用模型上下文窗口大小,动态调整分段数量。数值越高,预期被召回的文本分段数量越多。 -* **Score 阈值** - - 用于设置文本片段筛选的相似度阈值。向量检索的相似度分数需要超过设置的分数后才会被召回,数值越高,预期被召回的文本数量越少。 - -### 使用元数据筛选知识 - -#### 聊天流/工作流 - -在 **聊天流/工作流** 的 **知识检索** 节点中,你可以使用 **元数据筛选** 功能精确检索文档。该功能有助于你根据文档的元数据字段(如标签、类别或访问权限)优化检索结果。 - -##### 配置步骤 - -1. 选择筛选模式 - - - **禁用模式**(默认):禁用 **元数据筛选** 功能,不配置任何筛选条件。 - - - **自动模式**:系统会根据传输给该 **知识检索** 节点的 **查询变量** 自动配置筛选条件,适用于简单的筛选需求。 - - > 启用自动模式后,你依然需要在 **模型** 栏中选择合适的大模型以执行文档检索任务。 - - ![model_selection](https://assets-docs.dify.ai/2025/03/fe387793ad9923660f9f9470aacff01b.png) - - - **手动模式**:用户可以手动配置筛选条件,自由设置筛选规则,适用于复杂的筛选需求。 - -![](https://assets-docs.dify.ai/2025/03/ec6329e265e035e3a0d6941c9313a19d.png) - -2. 如果你选择了 **手动模式**,请参照以下步骤配置筛选条件: - - 1. 点击 **条件** 按钮,弹出配置框。 - - ![conditions](https://assets-docs.dify.ai/2025/03/cd80d150f6f5646350b7ac8dfee46429.png) - - 2. 点击配置框中的 **+添加条件** 按钮: - - - 可以从下拉列表中选择一个已选中知识库内的元数据字段,添加到筛选条件列表中。 - - > 如果你同时选择了多个知识库,下拉列表只会显示这些知识库共有的元数据字段。 - - - 可以在 **搜索元数据** 搜索框中搜索你需要的字段,添加到筛选条件列表中。 - - ![add_condition](https://assets-docs.dify.ai/2025/03/72678c4174f753f306378b748fbe6635.png) - - 3. 如果需要添加多条字段,可以重复点击 **+添加条件** 按钮。 - - ![add_more_fields](https://assets-docs.dify.ai/2025/03/aeb518c40aabdf467c9d2c23016d0a16.png) - - 4. 配置字段类型的筛选条件: - - | 字段类型 | 筛选条件 | 筛选条件说明与示例 | - | --- | --- | --- | - | 字符串 | is | 字段的值必须与你输入的值完全匹配。例如,如果你设置筛选条件为 `is "Published"`,则只会返回标记为 "Published" 的文档。 | - | | is not | 字段的值不能与你输入的值匹配。例如,如果你设置筛选条件为 `is not "Draft"`,则会返回所有未标记为 "Draft" 的文档。 | - | | is empty | 字段的值为空。如果你配置了此条件,可以检索到未标记该字符串的文档。 | - | | is not empty | 字段的值不为空。如果你配置了此条件,可以检索到标记了该字符串的文档。 | - | | contains | 字段的值包含你输入的文本。例如,如果你设置筛选条件为 `contains "Report"`,则会返回所有包含"Report"的文档,如"Monthly Report" 或 "Annual Report"。 | - | | not contains | 字段的值不包含你输入的文本。例如,如果你设置筛选条件为 `not contains "Draft"`,则会返回所有不包含 "Draft" 的文档。 | - | | starts with | 字段的值以你输入的文本开头。例如,如果你设置筛选条件为 `starts with "Doc"`,则会返回所有以"Doc"开头的文档,如 "Doc1"、"Document"等。 | - | | ends with | 字段的值以你输入的文本结尾。例如,如果你设置筛选条件为 `ends with "2024"`,则会返回所有以"2024"结尾的文档,如"Report 2024"、"Summary 2024"等。 | - | 数字 | = | 字段的值必须等于你输入的数字。例如,`= 10` 会匹配所有数字标记为 10 的文档。 | - | | ≠ | 字段的值不能等于你输入的数字。例如,`≠ 5` 会返回所有数字未标记为 5 的文档。 | - | | > | 字段的值必须大于你输入的数字。例如,`100` 会返回所有数字标记为大于 100 的文档。 | - | | < | 字段的值必须小于你输入的数字。例如,`< 50` 会返回所有数字标记为小于 50 的文档。 | - | | ≥ | 字段的值必须大于或等于你输入的数字。例如,`≥ 20` 会返回所有数字标记为大于或等于 20 的文档。 | - | | ≤ | 字段的值必须小于或等于你输入的数字。例如,`≤ 200` 会返回所有数字标记为小于或等于 200 的文档。 | - | | is empty | 字段未设置值。例如,`is empty` 会返回所有该字段未标记数字的文档。 | - | | is not empty | 字段已设置值。例如,`is not empty` 会返回所有该字段已标记数字的文档。 | - | 时间 | is | 字段的时间值必须与你选择的时间完全匹配。例如,`is "2024-01-01"` 只会返回标记为 2024 年 1 月 1 日的文档。 | - | | before | 字段的时间值必须早于你选择的时间。例如,`before "2024-01-01"` 会返回所有标记为 2024 年 1 月 1 日之前的文档。 | - | | after | 字段的时间值必须晚于你选择的时间。例如,`after "2024-01-01"` 会返回所有标记为 2024 年 1 月 1 日之后的文档。 | - | | is empty | 字段的时间值为空。如果你配置了此条件,可以检索到未标记该时间信息的文档。 | - | | is not empty | 字段的时间值不为空。如果你配置了此条件,可以检索到标记了该时间信息的文档。 | - - 5. 选择并添加元数据筛选值: - - **变量**:选择 **变量(Variable)**,并选择该**聊天流/工作流**中需要用于筛选文档的变量。 - - ![variable](https://assets-docs.dify.ai/2025/03/4c2c55ffcf0f72553fabdf23f86597d0.png) - - - **常量**:选择 **常量(Constant)**,并手动输入你需要的常量值。 - - > **时间** 字段类型仅支持使用常量筛选文档。如果你选用时间字段筛选文档,系统会弹出时间选择器,供你选择具体的时间节点。 - - ![date_picker](https://assets-docs.dify.ai/2025/03/593da1575ddc995d938bd0cc3847cf3c.png) - - - 当你输入常量筛选值时,该筛选值必须与该元数据字段值的文本完全一致,系统才能返回该文档。例如,当你设置筛选条件为 `starts with "App"` 或 `contains "App"` 时,系统会返回标记为 “Apple” 的文档,但不会返回标记为 “apple” 或 “APPLE” 的文档。 - - - 6. 配置筛选条件之间的逻辑关系 `AND` 或 `OR`。 - - `AND`:当一个文档满足所有筛选条件时,才能检索到该文档。 - - `OR`:只要一个文档满足其中任意一个筛选条件,就可以检索到该文档。 - - ![logic](https://assets-docs.dify.ai/2025/03/822dac015308dc5c01768afc0697c1ad.png) - - 7. 关闭弹窗,系统将自动保存你的选择。 - -#### 聊天助手 - -在**聊天助手**中,**元数据筛选** 功能位于界面左下方的 **上下文** 板块下方,配置方法与**聊天流/工作流**中的操作一致。你可以按照相同的步骤配置元数据筛选条件。 - -![chatbot](https://assets-docs.dify.ai/2025/03/9d9a64bde687a686f24fd99d6f193c57.png) - -### 在知识库内查看已关联的应用 - -知识库将会在左侧信息栏中显示已关联的应用数量。将鼠标悬停至圆形信息图标时将显示所有已关联的 Apps 列表,点击右侧的跳转按钮即可快速查看对应的应用。 - -![查看已关联的应用](https://assets-docs.dify.ai/2024/12/28899b9b0eba8996f364fb74e5b94c7f.png) - -### 常见问题 - -1. **如何选择多路召回中的 Rerank 设置?** - -如果用户知道确切的信息或术语,可以通过关键词检索精确发挥匹配结果,那么请将 “权重设置” 中的**关键词设置为 1**。 - -如果知识库内并未出现确切词汇,或者存在跨语言查询的情况,那么推荐使用 “权重设置” 中的**语义设置为 1**。 - -如果业务人员对于用户的实际提问场景比较熟悉,想要主动调整语义或关键词的比值,那么推荐自行调整 “权重设置” 里的比值。 - -如果知识库内容较为复杂,无法通过语义或关键词等简单条件进行匹配,同时要求较为精准的回答,愿意支付额外的费用,那么推荐使用 **Rerank 模型** 进行内容检索。 - -2. **为什么会出现找不到 “权重设置” 或要求必须配置 Rerank 模型等情况,应该如何处理?** - -以下是知识库检索方式对文本召回的影响情况: - -![](https://assets-docs.dify.ai/2025/03/3e581e276770632a508bb311d4b35add.png) - -3. **引用多个知识库时,无法调整 “权重设置”,提示错误应如何处理?** - -出现此问题是因为上下文内所引用的多个知识库内所使用的嵌入模型(Embedding)不一致,为避免检索内容冲突而出现此提示。推荐设置在“模型供应商”内设置并启用 Rerank 模型,或者统一知识库的检索设置。 - -4. **为什么在多路召回模式下找不到“权重设置”选项,只能看到 Rerank 模型?** - -请检查你的知识库是否使用了“经济”型索引模式。如果是,那么将其切换为“高质量”索引模式。 diff --git a/zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance.mdx.bak b/zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance.mdx.bak deleted file mode 100644 index 5b384295..00000000 --- a/zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance.mdx.bak +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: 知识库管理与文档维护 -version: '简体中文' ---- - -## 知识库管理 - -> 知识库管理页仅面向团队所有者、团队管理员、编辑权限角色开放。 - -在 Dify 团队首页中,点击顶部的 “知识库” tab 页,选择需要管理的知识库,轻点左侧导航中的**设置**进行调整。你可以调整知识库名称、描述、可见权限、索引模式、Embedding 模型和检索设置。 - - - - - -**知识库名称**,用于区分不同的知识库。 - -**知识库描述**,用于描述知识库内文档代表的信息。 - -**可见权限**,提供 **「 只有我 」** 、 **「 所有团队成员 」** 和 **「部分团队成员」** 三种权限范围。不具有权限的人将无法访问该知识库。若选择将知识库公开至其它成员,则意味着其它成员同样具备该知识库的查看、编辑和删除权限。 - -**索引模式**,详细说明请[参考文档](/zh-cn/user-guide/knowledge-base/knowledge-base-creation/upload-documents#3)。 - -**Embedding 模型**, 修改知识库的嵌入模型,修改 Embedding 模型将对知识库内的所有文档重新嵌入,原先的嵌入将会被删除。 - -**检索设置**,详细说明请[参考文档](/zh-cn/user-guide/knowledge-base/knowledge-base-creation/upload-documents#4)。 - -*** - -### 使用 API 维护知识库 - -Dify 知识库提供整套标准 API ,开发者通过 API 调用对知识库内的文档、分段进行增删改查等日常管理维护操作,请参考[知识库 API 文档](maintain-dataset-via-api)。 - - - - - -## 维护知识库中的文本 - -### 添加文档 - -知识库(Knowledge)是一些文档(Documents)的集合。文档可以由开发者或运营人员上传,或由同步其它数据源(对应数据源中的一个文件单位,例如 Notion 库内的一篇文档或新的在线文档网页)。 - -点击 「知识库」 > 「文档列表 ,然后轻点 「 添加文件 」,即可在已创建的知识库内上传新的文档。 - - - - - -*** - -### 禁用或归档文档 - -**禁用**:数据集支持将暂时不想被索引的文档或分段进行禁用,在数据集文档列表,点击禁用按钮,则文档被禁用;也可以在文档详情,点击禁用按钮,禁用整个文档或某个分段,禁用的文档将不会被索引。禁用的文档点击启用,可以取消禁用。 - -**归档**:一些不再使用的旧文档数据,如果不想删除可以将它进行归档,归档后的数据就只能查看或删除,不可以进行编辑。在数据集文档列表,点击归档按钮,则文档被归档,也可以在文档详情,归档文档。归档的文档将不会被索引。归档的文档也可以点击撤销归档。 - -*** - -### 查看文本分段 - -知识库内已上传的每个文档都会以文本分段(Chunks)的形式进行存储,你可以在分段列表内查看每一个分段的具体文本内容。 - - - - - -*** - -### 检查分段质量 - -文档分段对于知识库应用的问答效果有明显影响,在将知识库与应用关联之前,建议人工检查分段质量。 - -通过字符长度、标识符或者 NLP 语义分段等机器自动化的分段方式虽然能够显著减少大规模文本分段的工作量,但分段质量与不同文档格式的文本结构、前后文的语义联系都有关系,通过人工检查和订正可以有效弥补机器分段在语义识别方面的缺点。 - -检查分段质量时,一般需要关注以下几种情况: - -* **过短的文本分段**,导致语义缺失; - - - - - -* **过长的文本分段**,导致语义噪音影响匹配准确性; - - - - - -* **明显的语义截断**,在使用最大分段长度限制时会出现强制性的语义截断,导致召回时缺失内容; - - - - - -*** - -### 添加文本分段 - -在分段列表内点击 「 添加分段 」 ,可以在文档内自行添加一个或批量添加多个自定义分段。 - - - - - -批量添加分段时,你需要先下载 CSV 格式的分段上传模板,并按照模板格式在 Excel 内编辑所有的分段内容,再将 CSV 文件保存后上传。 - - - - - -*** - -### ![]()编辑文本分段 - -在分段列表内,你可以对已添加的分段内容直接进行编辑修改。包括分段的文本内容和关键词。 - - - - - -*** - -### 元数据管理 - -除了用于标记不同来源文档的元数据信息,例如网页数据的标题、网址、关键词、描述等。元数据将被用于知识库的分段召回过程中,作为结构化字段参与召回过滤或者显示引用来源。 - - - 元数据过滤及引用来源功能当前版本尚未支持。 - - - - - diff --git a/zh-hans/guides/knowledge-base/knowledge-request-rate-limit.mdx b/zh-hans/guides/knowledge-base/knowledge-request-rate-limit.mdx new file mode 100644 index 00000000..2d580d49 --- /dev/null +++ b/zh-hans/guides/knowledge-base/knowledge-request-rate-limit.mdx @@ -0,0 +1,40 @@ +--- +title: 知识库请求频率限制 +--- + +为了维护 Dify 云服务系统的稳定性,并提升所有用户的知识库使用体验,我们将从 **2025 年 2 月 24 日** 起引入知识库请求频率限制(Knowledge Request Rate Limit)。 + +## 什么是知识库请求频率限制? + +知识库请求频率限制,指一个工作区在知识库中每分钟可执行的最大操作数。这些操作包括数据集创建、文档管理,以及在应用或工作流中的知识库查询。 + +## 不同订阅版本的限制 + +- **Sandbox**:10 次/分钟 +- **Professional**:100 次/分钟 +- **Team**:1,000 次/分钟 + +例如,对于 **Sandbox 用户**,如果在 1 分钟内执行了 10 次命中测试,该用户的工作区将在接下来的 1 分钟内暂时无法执行受知识库请求频率限制的操作。 + +## 哪些操作会受到知识库请求频率限制? + +当你执行以下操作时,会受到知识库请求频率限制: + +1. 创建空数据集 +2. 删除数据集 +3. 更新数据集设置 +4. 上传文档 +5. 删除文档 +6. 更新文档 +7. 禁用文档 +8. 启用文档 +9. 归档文档 +10. 恢复文档 +11. 暂停文档处理 +12. 恢复文档处理 +13. 新增分段 +14. 删除分段 +15. 更新分段 +16. 批量导入分段 +17. 命中测试 +18. App 或 Workflow 中查询知识库(多路召回虽然会多次查询知识库,但是只记作一次请求) diff --git a/zh-hans/guides/knowledge-base/metadata.mdx.bak b/zh-hans/guides/knowledge-base/metadata.mdx.bak deleted file mode 100644 index 3005087e..00000000 --- a/zh-hans/guides/knowledge-base/metadata.mdx.bak +++ /dev/null @@ -1,409 +0,0 @@ ---- -title: 元数据 ---- - -## 什么是元数据? - -### 定义 - -元数据是用于描述其他数据的信息。简单来说,它是"关于数据的数据"。它就像一本书的目录或标签,可以为你介绍数据的内容、来源和用途。 -通过提供数据的上下文,元数据能帮助你在知识库内快速查找和管理数据。 - -### 知识库元数据定义 - -- **字段(Field)**:元数据字段是用于描述文档特定属性的标识项,每个字段代表文档的某个特征或信息。例如"author""language"等。 - -- **字段值(Value)**:字段值是该字段的具体信息或属性,例如"Jack""English"。 - -field_name_and_value - -- **字段值计数(Value Count)**:字段值计数是指在某条元数据字段中标记的字段值数量,包括重复项。例如,此处的"3"是字段值计数,指该字段中有 3 个独特的字段值。 - - - -- **值类型(Value Type)**:值类型指字段值的类型。 - - 目前,Dify 的元数据功能支持以下三种值类型: - - **字符串**(String):文本值。 - - **数字**(Number):数值。 - - **时间**(Time):日期和时间。 - -value_type - -## 如何管理知识库元数据? - -### 管理知识库元数据字段 - -在知识库管理界面,你可以创建、修改和删除元数据字段。 - -> 注意:所有在此界面进行的更新均为**全局更新**,这意味着对元数据字段列表的任何更改都会影响整个知识库,包括所有文档中标记的元数据。 - -#### 元数据管理界面简介 - -**进入元数据管理界面** - -在知识库管理界面,点击右上方的 **元数据** 按钮,进入元数据管理界面。 - -![metadata_entrance](https://assets-docs.dify.ai/2025/03/bd43305d49cc1511683b4a098c8f6e5a.png) - -![metadata_panel](https://assets-docs.dify.ai/2025/03/6000c85b5d2e29a2a5af5e0a047a7a59.png) - -**知识库元数据字段的类型** - -在知识库中,元数据字段分为两类:**内置元数据(Built-in)** 和 **自定义元数据**。 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
内置元数据(Built-in)自定义元数据
显示位置知识库界面 元数据 栏的下半部分。知识库界面 元数据 栏的上半部分。
启用方式默认禁用,需要手动开启才能生效。由用户根据需求自由添加。
生成方式启用后,由系统自动提取相关信息并生成字段值。用户手动添加,完全由用户自定义。
修改权限一旦生成,无法修改字段与字段值。可以删除或编辑字段名称,也可以修改字段值。
应用范围启用后,适用于已上传和新上传的所有文档。添加元数据字段后,字段会储存在知识库的元数据列表中/需要手动设置,才能将该字段应用于具体文档。
字段 - 由系统预定义,包括: -
    -
  • document_name (string):文件名
  • -
  • uploader (string):上传者
  • -
  • upload_date (time):上传日期
  • -
  • last_update_date (time):最后更新时间
  • -
  • source (string):文件来源
  • -
-
在初始状态下,知识库无自定义元数据字段,需要用户手动添加。
字段值类型 -
    -
  • 字符串 (string):文本值
  • -
  • 数字 (number):数值
  • -
  • 时间 (time):日期和时间
  • -
-
-
    -
  • 字符串 (string):文本值
  • -
  • 数字 (number):数值
  • -
  • 时间 (time):日期和时间
  • -
-
- -#### 新建元数据字段 - -1. 点击 **+添加元数据** 按钮,弹出 **新建元数据** 弹窗。 - -![new_metadata](https://assets-docs.dify.ai/2025/03/5086db42c40be64e54926b645c38c9a0.png) - -2. 在 **字段值类型** 中选择元数据字段的值类型。 - -3. 在 **名称** 框中填写字段的名称。 - -> 字段名仅支持小写字母、数字和下划线(_)字符,不支持空格和大写字母。 - -value_type - -4. 点击 **保存** 按钮,保存字段。 - -![save_field](https://assets-docs.dify.ai/2025/03/f44114cc58d4ba11ba60adb2d04c9b4c.png) - -#### 修改元数据字段 - -1. 点击单条元数据字段右侧的编辑按钮,弹出 **重命名** 弹窗。 - -![rename_field_1](https://assets-docs.dify.ai/2025/03/94327185cbe366bf99221abf2f5ef55a.png) - -2. 在 **名称** 框中修改字段名称。 - -> 此弹窗仅支持修改字段名称,不支持修改字段值类型。 - -rename_field_2 - -3. 点击 **保存** 按钮,保存修改后的字段。 - -> 修改并保存后,该字段将在知识库中的所有相关文档中同步更新。 - -![same_renamed_field](https://assets-docs.dify.ai/2025/03/022e42c170b40c35622b9b156c8cc159.png) - -#### 删除元数据字段 - -点击单条元数据字段右侧的删除按钮,可以删除该字段。 - -> 如果删除单条字段,该字段及该字段下包含的字段值将从知识库的所有文档中删除。 - -![delete_field](https://assets-docs.dify.ai/2025/03/022e42c170b40c35622b9b156c8cc159.png) - -### 编辑文档元数据信息 - -#### 批量编辑文档元数据信息 - -你可以在知识库管理界面批量编辑文档的元数据信息。 - -**打开编辑元数据弹窗** - -1. 打开知识库管理界面,在文档列表左侧的白色方框中勾选你希望批量操作的文档。勾选后,页面下方会弹出操作选项。 - -![edit_metadata_entrance](https://assets-docs.dify.ai/2025/03/18b0c435604db6173acba41662474446.png) - -2. 点击操作选项中的 **元数据**,弹出 **编辑元数据** 弹窗。 - -![edit_metadata](https://assets-docs.dify.ai/2025/03/719f3c31498f23747fed7d7349fd64ba.png) - -**批量新增元数据信息** - -1. 在 **编辑元数据** 弹窗中点击底部的 **+添加元数据** 按钮,弹出操作弹窗。 - -add_metadata - -- 如需为选中文档添加已创建的字段: - - - 可以从下拉列表中选择已有的字段,添加到字段列表中。 - - - 可以在 **搜索元数据** 搜索框中搜索你需要的字段,添加到该文档的字段列表中。 - -existing_field - -- 如需为选中文档新建字段,可以点击弹窗左下角的 **+新建元数据** 按钮,并参考前文的 **新建元数据字段** 章节新建字段。 - - > 在 **+新建元数据** 弹窗中新建的元数据字段,将自动同步至知识库字段列表中。 - -new_metadata_field - -- 如需管理已创建的字段,可以点击该弹窗右下角的 **管理** 按钮,跳转到知识库的管理界面。 - -manage_field - -2. *(可选)* 新增字段后,在字段值框内填写该字段相应的字段值。 - -value_for_field - -- 如果值类型为 **时间**,在填写字段值时会弹出时间选择器,供你选择具体时间。 - -date_picker - -3. 点击 **保存** 按钮,保存操作。 - -**批量删改元数据信息** - -1. 在 **编辑元数据** 弹窗中删改元数据信息: - -- **添加字段值**: 在需要添加元数据值的字段框内直接输入所需值。 - -- **重置字段值**: 将光标悬停在字段名左侧的蓝色圆点上,蓝点将变为 **重置** 按钮。点击蓝点,将字段框内修改后的内容重置为原始元数据值。 - -reset_values - -- **删除字段值**: - - - 删除一个字段值:在需要删除字段值的字段框内直接删除该字段值。 - - - 删除多个字段值:点击 **多个值** 卡片的删除图标,清空所有选中文档的该元数据字段的值。 - -multiple_values - -- **删除单条元数据字段**: 点击字段最右侧的删除符号,删除该字段。删除后,该字段会被横线划掉且置灰。 - - > 此操作仅会删除已选文档的该字段与字段值,字段本身依然保留在知识库中。 - -delete_fields - -2. 点击 **保存** 按钮,保存操作。 - -**调整批量操作的应用范围** - -- **调整批量操作的应用范围**: 你可以使用 **编辑元数据** 弹窗左下角的 **应用于所有文档** 选框来调整编辑模式中改动的应用范围。 - - - **否(默认)**: 如果不选中该选项,编辑模式中的改动仅对原本已有该元数据字段的文档生效,其他文档不会受到影响。 - - - **是**: 如果选中该选项,编辑模式中的改动会对所有选中的文档生效。原本没有该字段的文档,会自动添加该字段。 - -apply_all_changes - -#### 编辑单篇文档元数据信息 - -你可以在文档详情界面中编辑单篇文档的元数据信息。 - -**进入文档元数据编辑模式** - -1. 在文档详情界面,点击信息栏上方的 **开始标记** 按钮。 - -![details_page](https://assets-docs.dify.ai/2025/03/066cb8eaa89f6ec17aacd8b09f06771c.png) - -2. 进入文档元数据编辑模式。 - -![start_labeling](https://assets-docs.dify.ai/2025/03/4806c56e324589e1711c407f6a1443de.png) - -**新增文档元数据信息** - -1. 在文档的元数据编辑模式中,点击 **+添加元数据** 按钮,弹出操作弹窗。 -![add_metadata](https://assets-docs.dify.ai/2025/03/f9ba9b10bbcf6eaca787eed4fcde44da.png) - -- 如需使用新建字段为该文档标记字段值,可以点击弹窗左下角的 **+ 新建元数据** 按钮,并参考前文的 **新建元数据字段** 章节新建字段。 - - > 在文档页面新建的元数据字段,将自动同步至知识库字段列表中。 - - ![new_fields](https://assets-docs.dify.ai/2025/03/739e7e51436259fca45d16065509fabb.png) - -- 如需使用知识库已有的字段为该文档标记字段值,可以选择下列任意一种方式使用已有的字段: - - - 从下拉列表中选择知识库已有的字段,添加到该文档的字段列表中。 - - - 在 **搜索元数据** 搜索框中搜索你需要的字段,添加到该文档的字段列表中。 - - ![existing_fields](https://assets-docs.dify.ai/2025/03/5b1876e8bc2c880b3b774c97eba371ab.png) - -- 如需管理知识库已有的字段,可以点击弹窗右下角的 **管理** 按钮,跳转到知识库的管理界面。 - - ![manage_metadata](https://assets-docs.dify.ai/2025/03/8dc74a1d2cdd87294e58dbc3d6dd161b.png) - -2. *(可选)* 添加字段后,在字段名右侧的元数据栏中填写字段值。 - -![values_for_fields](https://assets-docs.dify.ai/2025/03/488107cbea73fd4583e043234fe2fd2e.png) - -3. 点击右上角的 **保存** 按钮,保存字段值。 - -**删改文档元数据信息** - -1. 在文档的元数据编辑模式中,点击右上角的 **编辑** 按钮,进入编辑模式。 - -![edit_mode](https://assets-docs.dify.ai/2025/03/bb33a0f9c6980300c0f979f8dc0d274d.png) - -2. 删改文档元数据信息: - - **删改字段值**: 在字段名右侧的字段值框内,删除或修改字段值。 - - > 此模式仅支持修改字段值,不支持修改字段名。 - - - **删除字段**: 点击字段值框右侧的删除按钮,删除字段。 - - > 此操作仅会删除该文档的该字段与字段值,字段本身依然保留在知识库中。 - -![edit_metadata](https://assets-docs.dify.ai/2025/03/4c0c4d83d3ad240568f316abfccc9c2c.png) - -3. 点击右上角的 **保存** 按钮,保存修改后的字段信息。 - -## 如何使用元数据功能在知识库中筛选文档? - -请参阅 [在应用内集成知识库](https://docs.dify.ai/zh-hans/guides/knowledge-base/integrate-knowledge-within-application) 中的 **使用元数据筛选知识** 章节。 - -## API 信息 - -请参阅 [通过 API 维护知识库](https://docs.dify.ai/zh-hans/guides/knowledge-base/knowledge-and-documents-maintenance/maintain-dataset-via-api)。 - -## FAQ - -- **元数据有什么作用?** - - - 提升搜索效率:用户可以根据元数据标签快速筛选和查找相关信息,节省时间并提高工作效率。 - - - 增强数据安全性:通过元数据设置访问权限,确保只有授权用户能访问敏感信息,保障数据的安全性。 - - - 优化数据管理能力:元数据帮助企业或组织有效分类和存储数据,提高数据的管理和检索能力,增强数据的可用性和一致性。 - - - 支持自动化流程:元数据在文档管理、数据分析等场景中可以自动触发任务或操作,简化流程并提高整体效率。 - -- **知识库元数据管理列表中的元数据字段和某篇文档中的元数据值有什么区别?** - -| | 定义 | 性质 | 举例 | -| --- | --- | --- | --- | -| 元数据管理列表中的元数据字段 | 预定义的字段,用于描述文档的某些属性。 | 全局性字段。所有文档都可以使用这些字段。 | 作者、文档类型、上传日期。 | -| 某篇文档中的元数据值 | 每个文档按需标记的针对特定文档的信息。 | 文档特定的值。每个文档根据其内容会标记不同的元数据值。 | 文档 A 的"作者"字段值为"张三",文档 B 的"作者"字段值为"李四"。 | - -- **"在知识库管理界面删除某条元数据字段""在编辑元数据弹窗中删除已选文档的某条元数据字段"和"在文档详情界面删除某条元数据字段"有什么区别?** - -| 操作方式 | 操作方法 | 影响范围 | 结果 | -| --- | --- | --- | --- | -| 在知识库管理界面删除某条元数据字段 | 在知识库管理界面,点击某条元数据字段右侧的删除图标,删除该字段。 | 从知识库管理列表中完全删除该元数据字段及其所有字段值。 | 该字段从知识库中移除,所有文档中的该字段及包含的所有字段值也会消失。 | -| 在编辑元数据弹窗中删除已选文档的某条元数据字段 | 在编辑元数据弹窗中,点击某条元数据字段右侧的删除图标,删除该字段。 | 仅删除已选文档的该字段与字段值,字段本身依然保留在知识库管理列表中。 | 选中文档中的字段与字段值被移除,但字段仍保留在知识库内,字段值计数会发生数值上的变化。 | -| 在文档详情界面删除某条元数据字段 | 在文档详情界面中的元数据编辑模式里,点击某条元数据字段右侧的删除图标,删除该字段。 | 仅删除该文档的该字段与字段值,字段本身依然保留在知识库管理列表中。 | 该文档中的字段与字段值被移除,但字段仍保留在知识库内,字段值计数会发生数值上的变化。 | diff --git a/zh-hans/guides/knowledge-base/readme.mdx.bak b/zh-hans/guides/knowledge-base/readme.mdx.bak deleted file mode 100644 index 2bb0b935..00000000 --- a/zh-hans/guides/knowledge-base/readme.mdx.bak +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: 功能简介 ---- - -知识库功能将 [RAG 管线](https://docs.dify.ai/zh-hans/learn-more/extended-reading/retrieval-augment)上的各环节可视化,提供了一套简单易用的用户界面来方便应用构建者管理个人或者团队的知识库,并能够快速集成至 AI 应用中。 - -开发者可以将企业内部文档、FAQ、规范信息等内容上传至知识库进行结构化处理,供后续 LLM 查询。 - -相比于 AI 大模型内置的静态预训练数据,知识库中的内容能够实时更新,确保 LLM 可以访问到最新的信息,避免因信息过时或遗漏而产生的问题。 - -LLM 接收到用户的问题后,将首先基于关键词在知识库内检索内容。知识库将根据关键词,召回相关度排名较高的内容区块,向 LLM 提供关键上下文以辅助其生成更加精准的回答。 - -开发者可以通过此方式确保 LLM 不仅仅依赖于训练数据中的知识,还能够处理来自实时文档和数据库的动态数据,从而提高回答的准确性和相关性。 - -**核心优势:** - -• **实时性**:知识库中的数据可随时更新,确保模型获得最新的上下文。 - -• **精准性**:通过检索相关文档,LLM 能够基于实际内容生成高质量的回答,减少幻觉现象。 - -• **灵活性**:开发者可自定义知识库内容,根据实际需求调整知识的覆盖范围。 - -*** - -准备文本文件,例如: - -* 长文本内容(TXT、Markdown、DOCX、HTML、JSON 甚至是 PDF) -* 结构化数据(CSV、Excel 等) -* 在线数据源(网页爬虫、Notion 等) - -将文件上传至“知识库”即可自动完成数据处理。 - -> 如果你的团队内部已建有独立知识库,可以通过[连接外部知识库](./knowledge-base-creation/connect-external-knowledge-base)与 Dify 建立连接。 - -### 使用情景 - -例如你希望基于现有知识库和产品文档建立一个 AI 客服助手,可以在 Dify 中将文档上传至知识库,并建立一个对话型应用。如果使用传统方式,从文本训练到 AI 客服助手开发,可能需要花费数周的时间,且难以持续维护并进行有效迭代。在 Dify 内,仅需三分钟即可完成上述过程并开始获取用户反馈。 - -### 知识库与文档 - -在 Dify 中,知识库(Knowledge)是一系列文档(Documents)的集合,一个文档内可能包含多组内容分段(Chunks),知识库可以被整体集成至一个应用中作为检索上下文使用。文档可以由开发者或运营人员上传,或由其它数据源同步。 - -如果你已自建文档库,可以通过[连接外部知识库](./knowledge-base-creation/connect-external-knowledge-base)功能将自有知识库与 Dify 平台相关联。无需重复将内容上传至 Dify 平台内的知识库即可让 AI 应用实时读取自建知识库中的内容。 diff --git a/zh-hans/guides/monitoring/README.mdx b/zh-hans/guides/monitoring/README.mdx new file mode 100644 index 00000000..8b09397a --- /dev/null +++ b/zh-hans/guides/monitoring/README.mdx @@ -0,0 +1,7 @@ +--- +title: 监测 +--- + +你可以在 **概览** 内监控、跟踪应用程序在生产环境中的性能,在数据分析仪表盘内分析生产环境中应用的使用成本、延迟、用户反馈、性能等指标,并通过持续调试、迭代不断改进你的应用程序。 + +![](https://assets-docs.dify.ai/2025/03/57814ba88e96305d0c92c68b1b5ea20e.png) diff --git a/zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik.mdx b/zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik.mdx new file mode 100644 index 00000000..3c75fec9 --- /dev/null +++ b/zh-hans/guides/monitoring/integrate-external-ops-tools/integrate-opik.mdx @@ -0,0 +1,355 @@ +--- +title: 集成 Opik +--- + +## Opik 简介 + +Opik 是一个开源的 LLM 评估平台,用于评估、测试和监控大型语言模型(LLM)应用。它由 Comet 开发,旨在促进对基于 LLM 的应用程序进行更直观的协作、测试和监控。 + + +如需了解更多详情,请参考 [Opik](https://www.comet.com/site/products/opik/)。 + + +--- + +## 开始配置 Opik + +### 1. 注册/登录 [Opik](https://www.comet.com/signup?from=llm) + +### 2. 获取 Opik API 密钥 + +从右上角的用户菜单中获取 Opik API 密钥。点击 **API Key**,然后点击 API Key 进行复制: + + + +### 3. 集成 Opik 与 Dify + +在 Dify 应用程序中配置 Opik。打开需要监控的应用程序,在侧边菜单中打开**监控**,并在页面上选择**追踪应用性能**。 + + + +点击配置后,将在 Opik 中创建的 **API Key** 和**项目名称**粘贴到配置中并保存。 + + + +成功保存后,你可以在当前页面查看监控状态。 + +## 查看监控数据 + +配置完成后,你可以照常调试或使用 Dify 应用程序。所有使用历史都可以在 Opik 中监控。 + + + +当你切换到 Opik 时,可以在仪表板中查看 Dify 应用程序的详细操作日志。 + + + +通过 Opik 的详细 LLM 操作日志将帮助你优化 Dify 应用程序的性能。 + + + +## 监控数据列表 + +### **工作流/对话流追踪信息** + +**用于追踪工作流和对话流** + +| 工作流 | Opik 追踪 | +| ---------------------------------- | -------------------------- | +| workflow_app_log_id/workflow_run_id | id | +| user_session_id | - 放置在元数据中 | +| `workflow_{id}` | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| Model token consumption | usage_metadata | +| metadata | metadata | +| error | error | +| \[workflow] | tags | +| conversation_id/none for workflow | conversation_id in metadata | + +**工作流追踪信息** + +- workflow_id - 工作流唯一标识符 +- conversation_id - 对话 ID +- workflow_run_id - 当前运行的 ID +- tenant_id - 租户 ID +- elapsed_time - 当前运行所用时间 +- status - 运行状态 +- version - 工作流版本 +- total_tokens - 当前运行使用的总令牌数 +- file_list - 处理的文件列表 +- triggered_from - 触发当前运行的来源 +- workflow_run_inputs - 当前运行的输入数据 +- workflow_run_outputs - 当前运行的输出数据 +- error - 当前运行期间遇到的错误 +- query - 运行期间使用的查询 +- workflow_app_log_id - 工作流应用程序日志 ID +- message_id - 关联的消息 ID +- start_time - 运行开始时间 +- end_time - 运行结束时间 +- workflow node executions - 工作流节点执行信息 +- 元数据 + - workflow_id - 工作流唯一标识符 + - conversation_id - 对话 ID + - workflow_run_id - 当前运行的 ID + - tenant_id - 租户 ID + - elapsed_time - 当前运行所用时间 + - status - 运行状态 + - version - 工作流版本 + - total_tokens - 当前运行使用的总令牌数 + - file_list - 处理的文件列表 + - triggered_from - 触发当前运行的来源 + +#### **消息追踪信息** + +**用于追踪 LLM 相关对话** + +| 聊天 | Opik LLM | +| ------------------------------- | --------------------------- | +| message_id | id | +| user_session_id | - 放置在元数据中 | +| "llm" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| Model token consumption | usage_metadata | +| metadata | metadata | +| \["message", conversation_mode] | tags | +| conversation_id | conversation_id in metadata | + +**消息追踪信息** + +- message_id - 消息 ID +- message_data - 消息数据 +- user_session_id - 用户会话 ID +- conversation_model - 对话模式 +- message_tokens - 消息中的令牌数 +- answer_tokens - 答案中的令牌数 +- total_tokens - 消息和答案中的总令牌数 +- error - 错误信息 +- inputs - 输入数据 +- outputs - 输出数据 +- file_list - 处理的文件列表 +- start_time - 开始时间 +- end_time - 结束时间 +- message_file_data - 与消息关联的文件数据 +- conversation_mode - 对话模式 +- 元数据 + - conversation_id - 对话 ID + - ls_provider - 模型提供商 + - ls_model_name - 模型 ID + - status - 消息状态 + - from_end_user_id - 发送用户的 ID + - from_account_id - 发送账户的 ID + - agent_based - 消息是否基于代理 + - workflow_run_id - 工作流运行 ID + - from_source - 消息来源 + +#### **审核追踪信息** + +**用于追踪对话审核** + +| 审核 | Opik Tool | +| -------------- | ----------------- | +| user_id | - 放置在元数据中 | +| "moderation" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | metadata | +| \["moderation"]| tags | + +**审核追踪信息** + +- message_id - 消息 ID +- user_id - 用户 ID +- workflow_app_log_id - 工作流应用程序日志 ID +- inputs - 审核输入数据 +- message_data - 消息数据 +- flagged - 内容是否被标记需要注意 +- action - 采取的具体行动 +- preset_response - 预设响应 +- start_time - 审核开始时间 +- end_time - 审核结束时间 +- 元数据 + - message_id - 消息 ID + - action - 采取的具体行动 + - preset_response - 预设响应 + +#### **建议问题追踪信息** + +**用于追踪建议问题** + +| 建议问题 | Opik LLM | +| --------------------- | ----------------- | +| user_id | - 放置在元数据中 | +| "suggested_question" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | metadata | +| \["suggested_question"]| tags | + +**消息追踪信息** + +- message_id - 消息 ID +- message_data - 消息数据 +- inputs - 输入内容 +- outputs - 输出内容 +- start_time - 开始时间 +- end_time - 结束时间 +- total_tokens - 令牌数量 +- status - 消息状态 +- error - 错误信息 +- from_account_id - 发送账户的 ID +- agent_based - 是否基于代理 +- from_source - 消息来源 +- model_provider - 模型提供商 +- model_id - 模型 ID +- suggested_question - 建议问题 +- level - 状态级别 +- status_message - 状态消息 +- 元数据 + - message_id - 消息 ID + - ls_provider - 模型提供商 + - ls_model_name - 模型 ID + - status - 消息状态 + - from_end_user_id - 发送用户的 ID + - from_account_id - 发送账户的 ID + - workflow_run_id - 工作流运行 ID + - from_source - 消息来源 + +#### **数据集检索追踪信息** + +**用于追踪知识库检索** + +| 数据集检索 | Opik Retriever | +| ------------------- | ----------------- | +| user_id | - 放置在元数据中 | +| "dataset_retrieval" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | metadata | +| \["dataset_retrieval"]| tags | +| message_id | parent_run_id | + +**数据集检索追踪信息** + +- message_id - 消息 ID +- inputs - 输入内容 +- documents - 文档数据 +- start_time - 开始时间 +- end_time - 结束时间 +- message_data - 消息数据 +- 元数据 + - message_id - 消息 ID + - ls_provider - 模型提供商 + - ls_model_name - 模型 ID + - status - 消息状态 + - from_end_user_id - 发送用户的 ID + - from_account_id - 发送账户的 ID + - agent_based - 是否基于代理 + - workflow_run_id - 工作流运行 ID + - from_source - 消息来源 + +#### **工具追踪信息** + +**用于追踪工具调用** + +| 工具 | Opik Tool | +| -------------------- | ----------------- | +| user_id | - 放置在元数据中 | +| tool_name | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | metadata | +| \["tool", tool_name] | tags | + +#### **工具追踪信息** + +- message_id - 消息 ID +- tool_name - 工具名称 +- start_time - 开始时间 +- end_time - 结束时间 +- tool_inputs - 工具输入 +- tool_outputs - 工具输出 +- message_data - 消息数据 +- error - 错误信息(如果有) +- inputs - 消息的输入 +- outputs - 消息的输出 +- tool_config - 工具配置 +- time_cost - 时间消耗 +- tool_parameters - 工具参数 +- file_url - 关联文件的 URL +- 元数据 + - message_id - 消息 ID + - tool_name - 工具名称 + - tool_inputs - 工具输入 + - tool_outputs - 工具输出 + - tool_config - 工具配置 + - time_cost - 时间消耗 + - error - 错误信息(如果有) + - tool_parameters - 工具参数 + - message_file_id - 消息文件 ID + - created_by_role - 创建者角色 + - created_user_id - 创建者用户 ID + +#### **生成名称追踪信息** + +**用于追踪对话标题生成** + +| 生成名称 | Opik Tool | +| ---------------------------- | ----------------- | +| user_id | - 放置在元数据中 | +| "generate_conversation_name" | name | +| start_time | start_time | +| end_time | end_time | +| inputs | inputs | +| outputs | outputs | +| metadata | metadata | +| \["generate_name"] | tags | + +**生成名称追踪信息** + +- conversation_id - 对话 ID +- inputs - 输入数据 +- outputs - 生成的对话名称 +- start_time - 开始时间 +- end_time - 结束时间 +- tenant_id - 租户 ID +- 元数据 + - conversation_id - 对话 ID + - tenant_id - 租户 ID diff --git a/zh-hans/guides/monitoring/integrate-external-ops-tools/readme.mdx b/zh-hans/guides/monitoring/integrate-external-ops-tools/readme.mdx new file mode 100644 index 00000000..b2c55f73 --- /dev/null +++ b/zh-hans/guides/monitoring/integrate-external-ops-tools/readme.mdx @@ -0,0 +1,33 @@ +--- +title: 集成外部 Ops 工具 +--- + +### 为什么需要 LLMOps 工具 + +尽管 LLM 拥有出色的推理和文本生成能力,但其内部运作机制仍然难以完全理解,这给基于 LLM 的应用开发带来了挑战。例如: + +* 评估输出**质量** +* 推理**成本**评估 +* 模型响应**延迟** +* 链式调用、Agent 和工具引入的**调试复杂**性 +* 复杂的用户意图理解 + +而 LangSmith、Langfuse 这类 LLMOps 工具,能够为 LLM 应用提供全面的追踪和深度评估能力,为开发者提供从应用的原型构建到生产、运营的完整生命周期支持。 + +* **原型阶段** + +LLM 应用在原型构建阶段通常涉及提示词测试、模型选择、RAG 检索策略和其他参数组合的快速实验。快速了解模型的执行效果对于此阶段非常重要。接入 Langfuse 可以在跟踪 dify 应用执行的每个步骤,提供清晰的可见性和调试信息,从而让开发者快速定位问题并减少调试时间。 + +* **测试阶段** + +进入测试阶段后,需要继续收集数据以改进和提高性能。 LangSmith 能够将运行作为示例添加到知识库中,从而扩展实际场景的测试覆盖范围。这是将日志系统和评估/测试系统置于同一平台中的一个关键优势。 + +* **生产阶段** + +进入生产环境后,开发团队还需要仔细检查应用关键数据点、增加基准知识库、人工注释以及深入分析运营数据结结果。尤其是在应用大规模使用中,运营和数据团队需要持续观测应用成本和性能,对模型以及应用表现进行优化。 + +### Dify 与 Ops 工具的集成 + +使用 Dify Workflow 编排 LLM 应用时,通常涵盖一系列节点和逻辑,具有较高的复杂性。 + +将 Dify 与外部 Ops 工具集成,有助于打破编排应用时可能面临的 LLM “黑盒”问题。开发者只需要在平台上进行简单的配置,即可追踪应用生命周期中的数据和指标,轻松评估在 Dify 上创建的 LLM 应用质量、性能和成本。 diff --git a/zh-hans/guides/tools/advanced-tool-integration.mdx b/zh-hans/guides/tools/advanced-tool-integration.mdx index a9fcda0d..30760cd5 100644 --- a/zh-hans/guides/tools/advanced-tool-integration.mdx +++ b/zh-hans/guides/tools/advanced-tool-integration.mdx @@ -1,6 +1,5 @@ --- title: 高级接入工具 -version: '简体中文' --- 在开始接入工具之前,请确保你已经阅读过[快速接入](/zh-cn/user-guide/tools/quick-tool-integration),并对 Dify 的工具接入流程有了基本的了解。 diff --git a/zh-hans/guides/tools/extensions/README.mdx b/zh-hans/guides/tools/extensions/README.mdx new file mode 100644 index 00000000..b20a657e --- /dev/null +++ b/zh-hans/guides/tools/extensions/README.mdx @@ -0,0 +1,10 @@ +--- +title: 扩展 +--- + +在创造 AI 应用的过程中,开发者面临着不断变化的业务需求和复杂的技术挑战。有效地利用扩展能力不仅可以提高应用的灵活性和功能性,还可以确保企业数据的安全性和合规性。 + +Dify 提供了以下两种扩展方式: + +* API 扩展 +* 代码扩展 diff --git a/zh-hans/guides/tools/readme.mdx b/zh-hans/guides/tools/readme.mdx new file mode 100644 index 00000000..58643d70 --- /dev/null +++ b/zh-hans/guides/tools/readme.mdx @@ -0,0 +1,18 @@ +--- +title: 工具 +--- + + +“工具”已全面升级为“插件”生态,详细的使用说明请参考[插件开发](https://docs.dify.ai/zh-hans/plugins/quick-start/install-plugins)。以下内容已归档。 + + +### 工具定义 + +工具可以扩展 LLM 的能力,比如联网搜索、科学计算或绘制图片,赋予并增强了 LLM 连接外部世界的能力。Dify 提供了两种工具类型:**第一方工具**和**自定义工具**。 + +你可以直接使用 Dify 生态提供的第一方内置工具,或者轻松导入自定义的 API 工具(目前支持 OpenAPI / Swagger 和 OpenAI Plugin 规范)。 + +#### 工具的作用: + +1. 工具使用户可以在 Dify 上创建更强大的 AI 应用,如你可以为智能助理型应用(Agent)编排合适的工具,它可以通过任务推理、步骤拆解、调用工具完成复杂任务。 +2. 方便将你的应用与其他系统或服务连接,与外部环境交互,如代码执行、对专属信息源的访问等。 diff --git a/zh-hans/guides/tools/tool-configuration/alphavantage.mdx b/zh-hans/guides/tools/tool-configuration/alphavantage.mdx new file mode 100644 index 00000000..9400371d --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/alphavantage.mdx @@ -0,0 +1,26 @@ +--- +title: AlphaVantage 股票分析 +version: '简体中文' +--- + +> 工具作者 [@zhuhao](https://github.com/hwzhuhao)。 + +AlphaVantage 一个在线平台,它提供金融市场数据和API,便于个人投资者和开发者获取股票报价、技术指标和股票分析。本 + +## 1. 申请 AlphaVantage API Key + +请在 [AlphaVantage](https://www.alphavantage.co/support/#api-key)申请 API Key。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > AlphaVantage > 去授权` 填写 API Key。 + +## 3. 使用工具 + +- **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `AlphaVantage` 工具节点。添加后,需要在节点内的 “输入变量 → 股票代码” 通过[变量](/zh-cn/user-guide/build-app/flow-app/variables)引用用户输入的查询内容。最后在 “结束” 节点内使用变量引用 `AlphaVantage` 节点输出的内容。 + +- **Agent 应用** + +在 Agent 应用内添加 `AlphaVantage` 工具,然后在对话框内发送股票代码或大致描述,调用工具得到准确的金融数据。 diff --git a/zh-hans/guides/tools/tool-configuration/bing.mdx b/zh-hans/guides/tools/tool-configuration/bing.mdx new file mode 100644 index 00000000..bf7f9737 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/bing.mdx @@ -0,0 +1,30 @@ +--- +title: Bing 搜索 +version: '简体中文' +--- + +> 工具作者 @Dify。 + +Bing 搜索工具能够帮助你在使用 LLM 应用的时候,获取联网搜索结果。以下是在 Dify 中配置和使用 Bing 搜索工具的步骤。 + +## 1. 申请 Bing API Key + +请在 [Azure 平台](https://platform.openai.com/)申请 API Key。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > Azure > 去授权` 填写 API Key。 + +![](/zh-cn/img/5e8f18c29c50f14c5c83d7b45c546725.png) + +## 3. 使用工具 + +你可以在以下应用类型中使用 Bing 工具。 + +- **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `Bing` 工具节点。 + +- **Agent 应用** + +在 Agent 应用内添加 `Bing` 工具,然后输入在线搜索指令,调用此工具。 diff --git a/zh-hans/guides/tools/tool-configuration/comfyui.mdx b/zh-hans/guides/tools/tool-configuration/comfyui.mdx new file mode 100644 index 00000000..1b642444 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/comfyui.mdx @@ -0,0 +1,23 @@ +--- +title: ComfyUI +version: '简体中文' +--- + +[ComfyUI](https://www.comfy.org/) 是一个强大的、模块化的生成图形的平台。现在你可以在 Dify 中使用它, 传入图片的提示词, 并得到生成的图片。 + +## 1. 确保已能正常运行 ComfyUI 的工作流。 +请参考其[官方文档](https://docs.comfy.org/get_started/gettingstarted),确保 ComfyUI 可以正常运行并生成图片。 + +## 2. 导出工作流的 API 文件。 + +![](/zh-cn/img/0503c5838f163b54884ca58240281f3f.png) + +如图所示,在工具栏中选择 `Save(API Format)`,如果没有该选择,则需要在设置中开启 `Dev Mode`。 + +## 3. 在 Dify 中集成 ComfyUI + +在 `工具 > ComfyUI > 去认证` 中填写访问地址,如果您使用的 docker 部署的 Dify,这个地址一般是 `http://host.docker.internal:8188`。 + +## 4. 在 Dify 中使用 ComfyUI + +打开其 `工作流` 工具,在 `WORKFLOW JSON` 中填入刚刚导出的 API 文件中的内容,就可以正常生成了。 diff --git a/zh-hans/guides/tools/tool-configuration/dall-e.mdx b/zh-hans/guides/tools/tool-configuration/dall-e.mdx new file mode 100644 index 00000000..b5fd6502 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/dall-e.mdx @@ -0,0 +1,32 @@ +--- +title: Dall·E +version: '简体中文' +--- + +> 工具作者 @Dify。 + +DALL-E 是由 OpenAI 开发的一种基于文本提示生成图像的工具。Dify 已接入 DALL-E 工具,以下是在 Dify 中配置和使用 DALL-E 绘图工具的步骤。 + +## 1. 申请 OpenAI 的 API Key + +请在 [OpenAI Platform](https://platform.openai.com/)申请 API Key,并确保账户内有足够的 Credits。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > DALL-E > 去授权` 填写 API Key。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tools-dalle.png) + +## 3. 使用工具 + +* **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `DALL-E 绘图` 工具节点。添加后,需要在节点内的 “输入变量 → 提示词” 内填写[变量](/zh-cn/user-guide/build-app/flow-app/variables)引用用户输入的提示词,或者是上一节点生成的内容。最后在 “结束” 节点内使用变量引用 `DALL-E 绘图` 输出的图像。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-dalle3-node.png) + +* **Agent 应用** + +在 Agent 应用内添加 `DALL-E` 工具,然后在对话框内发送图片描述,调用工具生成 AI 图像。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-agent-dalle3.png) diff --git a/zh-hans/guides/tools/tool-configuration/google.mdx b/zh-hans/guides/tools/tool-configuration/google.mdx new file mode 100644 index 00000000..d82da634 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/google.mdx @@ -0,0 +1,30 @@ +--- +title: Google +version: '简体中文' +--- + +> 工具作者 @Dify。 + +Google 搜索工具能够帮助你在使用 LLM 应用的时候,获取联网搜索结果。以下是在 Dify 中配置和使用 Google 搜索工具的步骤。 + +## 1. 申请 Serp API Key + +请在 [Serp 平台](https://serpapi.com/dashboard)申请 API Key。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > Google > 去授权` 填写 API Key。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tools-google.png) + +## 3. 使用工具 + +你可以在以下应用类型中使用 Google 工具。 + +* **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `Google` 工具节点。 + +* **Agent 应用** + +在 Agent 应用内添加 `Google` 工具,然后输入在线搜索指令,调用此工具。 diff --git a/zh-hans/guides/tools/tool-configuration/perplexity.mdx b/zh-hans/guides/tools/tool-configuration/perplexity.mdx new file mode 100644 index 00000000..de985210 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/perplexity.mdx @@ -0,0 +1,34 @@ +--- +title: Perplexity Search +version: '简体中文' +--- + +> 工具作者 @Dify。 + +Perplexity 是一个基于 AI 的搜索引擎,能够理解复杂的查询并提供准确、相关的实时答案。以下是在 Dify 中配置和使用 Perplexity Search 工具的步骤。 + +## 1. 申请 Perplexity API Key + +请在 [Perplexity](https://www.perplexity.ai/settings/api)申请 API Key,并确保账户内有足够的 Credits。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > Perplexity > 去授权` 填写 API Key。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tools-perplexity.png) + +## 3. 使用工具 + +你可以在以下应用类型中使用 Perplexity Search 工具。 + +* **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 Perplexity 工具节点。将用户输入的内容通过变量传递至 Perplexity 工具节点内的“查询”框中,按照需求调整 Perplexity 工具的内置参数,最后在“结束”节点的回复框中选中 Perplexity 工具节点的输出内容。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tools-chatflow-perplexity.png) + +* **Agent 应用** + +在 Agent 应用内添加 `Perplexity Search` 工具,然后输入相关指令即可调用此工具。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tools-agent-perplexity.png) diff --git a/zh-hans/guides/tools/tool-configuration/readme.mdx b/zh-hans/guides/tools/tool-configuration/readme.mdx new file mode 100644 index 00000000..7dc7b303 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/readme.mdx @@ -0,0 +1,16 @@ +--- +title: 工具配置 +--- + + + “工具”已全面升级为“插件”生态,详细的使用说明请参考[插件开发](/zh-hans/plugins/quick-start/install-plugins)。以下内容已归档。 + + +Dify 支持各种工具来增强应用的功能。每个工具都有独特的功能和参数,因此选择适合应用需求的工具。**在 Dify 中使用之前,请从工具提供商的官方网站获取 API 密钥。** + +> 在部分工具内配置凭据后,工作区中的所有成员都可以使用此工具,请注意对应 Key 背后的服务额度消耗。 + +## 工具集成指南 + +- [StableDiffusion](./stable-diffusion):一种基于文本提示生成图像的工具。 +- [SearXNG](./searxng):一个免费的互联网元搜索引擎,整合了各种搜索服务的结果。用户不会被跟踪,也不会被分析。 \ No newline at end of file diff --git a/zh-hans/guides/tools/tool-configuration/searchapi.mdx b/zh-hans/guides/tools/tool-configuration/searchapi.mdx new file mode 100644 index 00000000..c7d896d5 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/searchapi.mdx @@ -0,0 +1,32 @@ +--- +title: SearchApi +version: '简体中文' +--- + +> 工具作者 @SearchApi。 + +SearchApi 是一个强大的实时 SERP API,可提供来自 Google 搜索、Google 招聘、YouTube、Google 新闻等搜索引擎集合的结构化数据。以下是在 Dify 中配置和使用 SearchApi 搜索工具的步骤。 + +## 1. 申请 Search API Key + +请在 [SearchApi](https://www.searchapi.io/)申请 API Key。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > SearchApi > 去授权` 填写 API Key。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tool-searchapi.png) + +## 3. 使用工具 + +你可以在以下应用类型中使用 SearchApi 工具。 + +* **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `SearchApi` 系列工具节点,提供 Google Jobs API,Google News API,Google Search API,YouTube 脚本 API 四种工具。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tool-searchapi-flow.png) + +* **Agent 应用** + +在 Agent 应用内选择需要添加的 `SearchApi` 工具,然后输入指令调用工具。 diff --git a/zh-hans/guides/tools/tool-configuration/searxng.mdx b/zh-hans/guides/tools/tool-configuration/searxng.mdx new file mode 100644 index 00000000..24567b49 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/searxng.mdx @@ -0,0 +1,29 @@ +--- +title: SearXNG +version: '简体中文' +--- + +> 工具作者 @Junytang。 + +SearXNG 是一个免费的互联网元搜索引擎,整合了各种搜索服务的检索结果。用户不会被跟踪,搜索行为也不会被分析。现在你可以直接在 Dify 中使用此工具。 + +下文将介绍如何使用 Docker 将 SearXNG 集成到 Dify。 + +## 1. 修改 Dify 配置文件 + +SearXNG 的配置文件位于 `dify/api/core/tools/provider/builtin/searxng/docker/settings.yml`, 配置文档可参考[这里](https://docs.searxng.org/admin/settings/index.html)。 + +你可以按需修改配置,也可直接使用默认配置。 + +## 2. 启动服务 + +在 Dify 根目录下启动 Docker 容器。 + +```bash +cd dify +docker run --rm -d -p 8081:8080 -v "${PWD}/api/core/tools/provider/builtin/searxng/docker:/etc/searxng" searxng/searxng +``` + +## 3. 使用 SearXNG + +在 `工具 > SearXNG > 去认证` 中填写访问地址,建立 Dify 服务与 SearXNG 服务的连接。SearXNG 的 Docker 内网地址一般是 `http://host.docker.internal:8081`。 diff --git a/zh-hans/guides/tools/tool-configuration/serper.mdx b/zh-hans/guides/tools/tool-configuration/serper.mdx new file mode 100644 index 00000000..4dd16792 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/serper.mdx @@ -0,0 +1,30 @@ +--- +title: Serper +version: '简体中文' +--- + +> 工具作者 @zhuhao。 + +Serper 是一个强大的实时搜索引擎工具API,可提供来自 Google 搜索引擎搜索的结构化数据。以下是在 Dify 中配置和使用 Serper 搜索工具的步骤。 + +## 1. 申请 Serp API Key + +请在 [Serper 平台](https://serper.dev/signup)申请 API Key。 + +## 2. 在 Dify 内填写配置 + +在 Dify 导航页内轻点 `工具 > Serper > 去授权` 填写 API Key。 + +![](/zh-cn/user-guide/.gitbook/assets/zh-tool-serper.png) + +## 3. 使用工具 + +你可以在以下应用类型中使用 Serper 工具。 + +* **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `Serper` 工具节点。 + +* **Agent 应用** + +在 Agent 应用内选择需要添加的 `Serper` 工具,然后输入指令调用工具。 diff --git a/zh-hans/guides/tools/tool-configuration/siliconflow.mdx b/zh-hans/guides/tools/tool-configuration/siliconflow.mdx new file mode 100644 index 00000000..6b9f1564 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/siliconflow.mdx @@ -0,0 +1,44 @@ +--- +title: SiliconFlow (支持 Flux 绘图) +version: '简体中文' +--- + +> 工具作者 @hjlarry + +SiliconCloud 基于优秀的开源基础模型,提供高性价比的 GenAI 服务。你可以通过 **SiliconFlow** 在 Dify 内调用 Flux 、Stable Diffusion 绘图模型,搭建你的专属 AI 绘图应用。以下是在 Dify 中配置 SiliconFlow 工具的步骤。 + +### 1. 申请 SiliconCloud API Key + +请在 [SiliconCloud API 管理页面](https://cloud.siliconflow.cn/account/ak) 新建 API Key 并保证有足够余额。 + +### 2. 在 Dify 内填写配置 + +在 Dify 的工具页中点击 `SiliconCloud > 去授权` 填写 API Key。 + + + + + +### 3. 使用工具 + +* **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `SiliconFlow` 工具节点。 + +将用户输入的内容通过[变量](../../workflow/variables)传递至 Siliconflow 工具的 Flux 或 Stable Diffusion 节点内的“提示词”“负面提示词”框中,按照需求调整内置参数,最后在“结束”节点的回复框中选中 Siliconflow 工具节点的输出内容(文本、图片等)。 + + + + + +* **Agent 应用** + +在 Agent 应用内添加 `Stable Diffusion` 或 `Flux` 工具,然后在对话框内发送图片描述,调用工具生成 AI 图像。 + + + + + + + + diff --git a/zh-hans/guides/tools/tool-configuration/stable-diffusion.mdx b/zh-hans/guides/tools/tool-configuration/stable-diffusion.mdx new file mode 100644 index 00000000..d9169761 --- /dev/null +++ b/zh-hans/guides/tools/tool-configuration/stable-diffusion.mdx @@ -0,0 +1,80 @@ +--- +title: Stable Diffusion +version: '简体中文' +--- + +> 工具作者 @Dify。 + +Stable Diffusion 是一种基于文本提示生成图像的工具,Dify 已经实现了访问 Stable Diffusion WebUI API 的接口,因此你可以直接在 Dify 中使用它。以下是在 Dify 中集成 Stable Diffusion 的步骤。 + +## 1. 初始化本地环境 + +推荐使用装有较强 GPU 的机器来安装和驱动 Stable Diffusion,但这并不是必须的,你也可以使用 CPU 来生成图像,但速度可能会很慢。 + +## 2. 安装并启动 Stable Diffusion WebUI + +1. 从[官方仓库](https://github.com/AUTOMATIC1111/stable-diffusion-webui)克隆 Stable Diffusion WebUI 仓库 + +```bash +git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui +``` + +2. 运行命令启动 Stable Diffusion WebUI。 + +克隆仓库后,切换到仓库目录。根据系统的不同,可能需要使用不同的命令来启动 WebUI。 + +#### Windows + +```bash +cd stable-diffusion-webui +./webui.bat --api --listen +``` + +#### Linux +```bash +cd stable-diffusion-webui +./webui.sh --api --listen +``` + +3. 准备模型 + +现在你可以根据终端中显示的地址在浏览器中访问 Stable Diffusion WebUI,但模型还不可用。你需要从 HuggingFace 或其他来源下载模型,并将其放在 Stable Diffusion WebUI 的 `models` 目录中。 + +例如,我们使用 [pastel-mix](https://huggingface.co/JamesFlare/pastel-mix) 作为模型,使用 `git lfs` 下载模型并将其放在 `stable-diffusion-webui` 的 `models` 目录中。 + +```bash +git clone https://huggingface.co/JamesFlare/pastel-mix +``` + +4. 获取模型名称 + +现在你可以在模型列表中看到 `pastel-mix`,但我们仍然需要获取模型名称,访问 `http://your_id:port/sdapi/v1/sd-models`,你将看到如下的模型名称。 + +```json +[ + { + "title": "pastel-mix/pastelmix-better-vae-fp32.ckpt [943a810f75]", + "model_name": "pastel-mix_pastelmix-better-vae-fp32", + "hash": "943a810f75", + "sha256": "943a810f7538b32f9d81dc5adea3792c07219964c8a8734565931fcec90d762d", + "filename": "/home/takatost/stable-diffusion-webui/models/Stable-diffusion/pastel-mix/pastelmix-better-vae-fp32.ckpt", + "config": null + }, +] +``` + +`model_name` 就是我们需要的,这个例子中是 `pastel-mix_pastelmix-better-vae-fp32`。 + +## 3. 在 Dify 集成 Stable Diffusion + +在 `工具 > StableDiffusion > 去认证` 中填写你在之前步骤中获取的认证信息和模型配置。 + +## 4. 完成 + +- **Chatflow / Workflow 应用** + +Chatflow 和 Workflow 应用均支持添加 `Stable Diffusion` 工具节点。添加后,需要在节点内的 “输入变量 → 提示词” 内填写[变量](/zh-cn/user-guide/build-app/flow-app/variables)引用用户输入的提示词,或者是上一节点生成的内容。最后在 “结束” 节点内使用变量引用 `Stable Diffusion` 输出的图像。 + +- **Agent 应用** + +在 Agent 应用内添加 `Stable Diffusion` 工具,然后在对话框内发送图片描述,调用工具生成 AI 图像。 diff --git a/zh-hans/guides/workflow/error-handling/predefined-nodes-failure-logic.mdx b/zh-hans/guides/workflow/error-handling/predefined-nodes-failure-logic.mdx index ca69ca08..4ca5bbd9 100644 --- a/zh-hans/guides/workflow/error-handling/predefined-nodes-failure-logic.mdx +++ b/zh-hans/guides/workflow/error-handling/predefined-nodes-failure-logic.mdx @@ -56,8 +56,3 @@ title: 预定义异常处理逻辑 | --------------- | ------------------------------------------------------------------------------------------------------------- | | `error_type` | 错误类型。不同类型的节点有着不同的[错误类型](https://docs.dify.ai/guides/workflow/error-handling/error-type),开发者可以根据不同的错误标识编排对应方案。 | | `error_message` | 错误信息,异常节点输出的具体故障信息。开发者可以传递给下游的 LLM 节点进行修复,或连接邮箱工具推送信息。 | - - - - - diff --git a/zh-hans/guides/workflow/concepts.mdx b/zh-hans/guides/workflow/key-concept.mdx similarity index 100% rename from zh-hans/guides/workflow/concepts.mdx rename to zh-hans/guides/workflow/key-concept.mdx diff --git a/zh-hans/guides/workflow/application-publishing.mdx b/zh-hans/guides/workflow/publish.mdx similarity index 100% rename from zh-hans/guides/workflow/application-publishing.mdx rename to zh-hans/guides/workflow/publish.mdx diff --git a/zh-hans/guides/workflow/readme.mdx b/zh-hans/guides/workflow/readme.mdx new file mode 100644 index 00000000..1c327013 --- /dev/null +++ b/zh-hans/guides/workflow/readme.mdx @@ -0,0 +1,47 @@ +--- +title: 工作流 +--- + +### 基本介绍 + +工作流通过将复杂的任务分解成较小的步骤(节点)降低系统复杂度,减少了对提示词技术和模型推理能力的依赖,提高了 LLM 应用面向复杂任务的性能,提升了系统的可解释性、稳定性和容错性。 + +Dify 工作流分为两种类型: + +* **Chatflow**:面向对话类情景,包括客户服务、语义搜索、以及其他需要在构建响应时进行多步逻辑的对话式应用程序。 +* **Workflow**:面向自动化和批处理情景,适合高质量翻译、数据分析、内容生成、电子邮件自动化等应用程序。 + +![](https://assets-docs.dify.ai/2025/03/cbf76f9ce2a81573ea80e135dce42615.png) + +为解决自然语言输入中用户意图识别的复杂性,Chatflow 提供了问题理解类节点。相对于 Workflow 增加了 Chatbot 特性的支持,如:对话历史(Memory)、标注回复、Answer 节点等。 + +为解决自动化和批处理情景中复杂业务逻辑,工作流提供了丰富的逻辑节点,如代码节点、IF/ELSE 节点、模板转换、迭代节点等,除此之外也将提供定时和事件触发的能力,方便构建自动化流程。 + +### 常见案例 + +* 客户服务 + +通过将 LLM 集成到你的客户服务系统中,你可以自动化回答常见问题,减轻支持团队的工作负担。 LLM 可以理解客户查询的上下文和意图,并实时生成有帮助且准确的回答。 + +* 内容生成 + +无论你需要创建博客文章、产品描述还是营销材料,LLM 都可以通过生成高质量内容来帮助你。只需提供一个大纲或主题,LLM将利用其广泛的知识库来制作引人入胜、信息丰富且结构良好的内容。 + +* 任务自动化 + +可以与各种任务管理系统集成,如 Trello、Slack、Lark、以自动化项目和任务管理。通过使用自然语言处理,LLM 可以理解和解释用户输入,创建任务,更新状态和分配优先级,无需手动干预。 + +* 数据分析和报告 + +可以用于分析大型知识库并生成报告或摘要。通过提供相关信息给 LLM,它可以识别趋势、模式和洞察力,将原始数据转化为可操作的智能。对于希望做出数据驱动决策的企业来说,这尤其有价值。 + +* 邮件自动化处理 + +LLM 可以用于起草电子邮件、社交媒体更新和其他形式的沟通。通过提供简要的大纲或关键要点,LLM 可以生成一个结构良好、连贯且与上下文相关的信息。这样可以节省大量时间,并确保你的回复清晰和专业。 + +### 如何开始 + +* 从一个空白的工作流开始构建或者使用系统模板帮助你开始; +* 熟悉基础操作,包括在画布上创建节点、连接和配置节点、调试工作流、查看运行历史等; +* 保存并发布一个工作流; +* 在已发布应用中运行或者通过 API 调用工作流;