diff --git a/en/use-dify/build/collaboration.mdx b/en/use-dify/build/collaboration.mdx index 4630b43b..ff968a97 100644 --- a/en/use-dify/build/collaboration.mdx +++ b/en/use-dify/build/collaboration.mdx @@ -1,7 +1,6 @@ --- title: Collaborate with Workspace Members sidebarTitle: Collaboration -description: Work together on building workflows in real time icon: "users" --- diff --git a/en/use-dify/build/file-system.mdx b/en/use-dify/build/file-system.mdx index cdd4f1da..51e806ac 100644 --- a/en/use-dify/build/file-system.mdx +++ b/en/use-dify/build/file-system.mdx @@ -8,7 +8,7 @@ Each application using [sandboxed runtime](/en/use-dify/build/runtime#sandboxed- The file system contains two types of files: -- **Resources**: Persistent files you provide, such as skills. +- **Resources**: Persistent files you upload or create, such as skills. - **Artifacts**: Temporary files LLMs generate during each run. @@ -24,6 +24,8 @@ Resources are files you create or import for your workflows. LLMs can read but c For example, instead of repeating style guidelines and uploading brand materials every time you need an LLM to generate marketing copy, create a `marketing-copy` skill with everything included and simply reference it whenever needed. +Think of a skill as a detailed SOP (Standard Operating Procedure) and the LLM as a capable new hire. The new hire has general abilities but doesn't know your company's specific processes. A skill provides everything they need—step-by-step instructions, reference materials, tools to use—so they can complete tasks the way you expect. + #### Create or Import Skills Import skills you've been using elsewhere, start with our ready-made skill templates, or create custom ones directly in the file system. diff --git a/en/use-dify/build/runtime.mdx b/en/use-dify/build/runtime.mdx index aae6c3f5..54283d29 100644 --- a/en/use-dify/build/runtime.mdx +++ b/en/use-dify/build/runtime.mdx @@ -23,10 +23,10 @@ Dify offers two runtime environments: **Sandboxed Runtime** and **Classic Runtim - **Access external resources** - Fetch files from URLs, clone repositories, or retrieve data from external sources - - **Work with files** - Access resources like **[skills](/en/use-dify/build/file-system#skills)** in the [file system](/en/use-dify/build/file-system), process files across formats, and generate multimodal artifacts using scripts and installed tools + - **Work with files** - Access resources like **[skills](/en/use-dify/build/file-system#skills)** in the [file system](/en/use-dify/build/file-system), process files across formats, and generate multimodal artifacts using scripts and tools - In sandboxed runtime, the Agent node combines the roles of both LLM and Agent. + In sandboxed runtime, the Agent node combines the roles of both the LLM and Agent nodes in classic runtime. For quick, simple tasks that don't need these advanced capabilities, you can disable them by turning off **[Agent Mode](/en/use-dify/nodes/agent#enable-command-execution)** for faster responses and lower token costs. diff --git a/en/use-dify/nodes/agent.mdx b/en/use-dify/nodes/agent.mdx index a2959b69..ed6acb2e 100644 --- a/en/use-dify/nodes/agent.mdx +++ b/en/use-dify/nodes/agent.mdx @@ -1,6 +1,6 @@ --- title: "Agent" -description: "Give LLMs autonomous control over tools for complex task execution" +description: "Let LLMs autonomously complete complex tasks" icon: "robot" --- @@ -182,7 +182,7 @@ icon: "robot" Toggle on **Agent Mode** to let the model use the built-in bash tool to execute commands in the sandboxed runtime. - This is the foundation for all advanced capabilities: when the model calls other Dify tools, performs file operations, runs scripts, or accesses external resources, it does so by calling the bash tool to execute the underlying commands. + This is the foundation for all advanced capabilities: when the model calls any other tools, performs file operations, runs scripts, or accesses external resources, it does so by calling the bash tool to execute the underlying commands. For quick, simple tasks that don't require these capabilities, you can disable **Agent Mode** to get faster responses and lower token costs. @@ -260,7 +260,7 @@ icon: "robot" ## Handle Errors - Configure automatic retries for temporary issues (like network glitches) and a fallback error handling strategy to keep the workflow running if errors persist. + Configure automatic retries for temporary issues (like network glitches), or a fallback error handling strategy to keep the workflow running if errors persist. Handle Errors diff --git a/en/use-dify/nodes/command.mdx b/en/use-dify/nodes/command.mdx index 9bf6cf82..8950915f 100644 --- a/en/use-dify/nodes/command.mdx +++ b/en/use-dify/nodes/command.mdx @@ -1,5 +1,6 @@ --- title: Command +description: Execute shell commands directly in your workflow icon: "rectangle-terminal" --- @@ -7,8 +8,6 @@ icon: "rectangle-terminal" This node is only available in applications using the sandboxed runtime. -Use Command nodes to execute shell commands directly in your workflow. - While Agent nodes can execute commands autonomously, Command nodes are better when you know exactly what command to run and don't need LLM reasoning. They're faster and don't consume tokens. Commands run in the root directory by default. To use a different working directory, type an existing path or one that will be created by upstream nodes during execution. diff --git a/en/use-dify/nodes/knowledge-retrieval.mdx b/en/use-dify/nodes/knowledge-retrieval.mdx index f6e75e1c..0635d352 100644 --- a/en/use-dify/nodes/knowledge-retrieval.mdx +++ b/en/use-dify/nodes/knowledge-retrieval.mdx @@ -116,7 +116,7 @@ To use the retrieval results as context in an LLM node: 3. Optional: If the LLM is vision-capable, enable **Vision** so it can process image attachments in the retrieval results. - You don't need to specify any vision input variable. Once **Vision** is enabled, the LLM will automatically access any retrieved images. + You don't need to specify the retrieval results as the vision input. Once **Vision** is enabled, the LLM will automatically access any retrieved images. -In chatflows, citations are shown alongside responses that reference knowledge by default. You can turn this off by disabling **Citation and Attributions** in **Features**. \ No newline at end of file +In chatflows, citations are shown alongside responses that reference knowledge by default. You can turn this off by disabling **Citation and Attributions** in **Features** at the top right corner of the canvas. \ No newline at end of file diff --git a/en/use-dify/nodes/llm.mdx b/en/use-dify/nodes/llm.mdx index 053c08de..bc69c7fe 100644 --- a/en/use-dify/nodes/llm.mdx +++ b/en/use-dify/nodes/llm.mdx @@ -1,6 +1,6 @@ --- title: "LLM" -description: "Invoke large language models for text generation and analysis" +description: "Invoke large language models to generate text, analyze content, and complete complex tasks with tools" icon: "brain" --- @@ -123,8 +123,6 @@ Please explain in simple and easy-to-understand language. Provide examples when {% elif user_level == "intermediate" %} You may use some technical terms, but provide appropriate explanations. Offer practical advice and best practices. {% else %} You may delve into technical details and use professional terminology. Focus on advanced use cases and optimization solutions. {% endif %} - -User question: {{ query }} ``` @@ -150,7 +148,7 @@ A user message will be automatically added to pass the current user query and an **Window Size** controls how many recent exchanges to retain. For example, `5` keeps the last 5 user-query and LLM-response pairs. -## Add Dify Tools +## Use Dify Tools Only models with the Tool Call tag can use Dify tools. @@ -216,4 +214,4 @@ Describing an output format in instructions can produce inconsistent results. Fo Configure automatic retries for temporary issues (like network glitches) and a fallback error handling strategy to keep the workflow running if errors persist. - Handle Errors \ No newline at end of file +Handle Errors \ No newline at end of file diff --git a/en/use-dify/nodes/tools.mdx b/en/use-dify/nodes/tools.mdx index 6553a404..05748015 100644 --- a/en/use-dify/nodes/tools.mdx +++ b/en/use-dify/nodes/tools.mdx @@ -101,7 +101,7 @@ The system creates an internal LLM node that reads the chat history of the selec 2. Describe what you want to extract from its chat history. -3. Click **View Internals** and test-run the internal LLM node. The node imports the upstream node's chat history and uses structured output to match the required format. +3. Click **View Internals** and test-run the internal LLM node. The node automatically imports the upstream node's chat history and uses structured output to match the required format. 4. Check the output and refine as needed. diff --git a/en/use-dify/nodes/upload-file-to-sandbox.mdx b/en/use-dify/nodes/upload-file-to-sandbox.mdx index 7f786d5d..e9aa9883 100644 --- a/en/use-dify/nodes/upload-file-to-sandbox.mdx +++ b/en/use-dify/nodes/upload-file-to-sandbox.mdx @@ -10,7 +10,7 @@ icon: "upload" When files are passed directly to an LLM, processing is limited by the model's own multimodal capabilities. While the [Doc Extractor](/en/use-dify/nodes/doc-extractor) node can convert various file types to text for LLMs to better process, its supported formats are still limited. -This is where the Upload File to Sandbox node helps. Once files are uploaded, downstream [Agent nodes](/en/use-dify/nodes/agent#sandboxed-runtime) (with **Agent Mode** enabled) can execute commands to install tools and run scripts as needed, converting files into formats LLMs can process. +This is where the Upload File to Sandbox node helps. Once files are uploaded, downstream [Agent nodes](/en/use-dify/nodes/agent#sandboxed-runtime) (with **Agent Mode** enabled) can execute commands to install tools and run scripts in the sandbox, converting files into formats LLMs can process. - Processing results depends on the model's reasoning capability. @@ -32,5 +32,5 @@ This is where the Upload File to Sandbox node helps. Once files are uploaded, do ``` - The `file_name` variable also includes the file extension (e.g., `data.csv`). + The `file_name` variable includes the file extension (e.g., `data.csv`). \ No newline at end of file diff --git a/en/use-dify/publish/publish-to-marketplace.mdx b/en/use-dify/publish/publish-to-marketplace.mdx index 62dcec7e..f0c5e562 100644 --- a/en/use-dify/publish/publish-to-marketplace.mdx +++ b/en/use-dify/publish/publish-to-marketplace.mdx @@ -1,11 +1,11 @@ --- title: "Publish to Marketplace" sidebarTitle: "Marketplace" -description: "Publish your workflows to Dify Marketplace and share them with the world" +description: "Publish your apps to Dify Marketplace and share them with the world" icon: "store" --- -Publish your workflow and chatflow apps as templates to Dify Marketplace, where other Dify users can discover and use them. If you've joined the [Affiliate Program](https://dify.ai/affiliate-program), you can also earn revenue from your templates. +Publish your apps as templates to Dify Marketplace, where other Dify users can discover and use them. If you've joined the [Affiliate Program](https://dify.ai/affiliate-program), you can also earn revenue from your templates. ## Submit Templates @@ -15,7 +15,7 @@ There are two ways to submit: - On the canvas, click **Publish** > **Publish to Marketplace**. + In your app, click **Publish** > **Publish to Marketplace**. This takes you to the [Creators Platform]() where you can fill in the template details and submit for review. @@ -36,7 +36,7 @@ Keep the template library consistent and searchable. - Overview - Setup steps -**Inside the workflow, you can use any language (e.g. Chinese) for**: +**Inside the app, you can use any language (e.g. Chinese) for**: - Node names - Prompts / system messages diff --git a/en/use-dify/workspace/tools.mdx b/en/use-dify/workspace/tools.mdx index b0323ae7..c3542934 100644 --- a/en/use-dify/workspace/tools.mdx +++ b/en/use-dify/workspace/tools.mdx @@ -1,5 +1,6 @@ --- -title: Tools +title: Dify Tools +sidebarTitle: Tools icon: "wrench" --- diff --git a/zh/use-dify/build/collaboration.mdx b/zh/use-dify/build/collaboration.mdx index 5d6f766a..e30e9fb4 100644 --- a/zh/use-dify/build/collaboration.mdx +++ b/zh/use-dify/build/collaboration.mdx @@ -1,13 +1,12 @@ --- title: 与工作区成员协作 sidebarTitle: 协作 -description: 实时协作构建工作流 icon: "users" --- ⚠️ 本文档由 AI 自动翻译。如有任何不准确之处,请参考[英文原版](/en/use-dify/build/collaboration)。 -拥有编辑权限及以上的工作区成员可以同时编辑同一个工作流。右键点击画布并选择**添加评论**来分享想法。 +拥有编辑权限及以上的工作区成员可实时编辑同一个工作流。右键点击画布并选择**添加评论**来分享想法。 要更快地添加多条评论,按 `C` 键进入评论模式。如果你在评论中 `@` 提及其他人,他们将收到邮件通知。 diff --git a/zh/use-dify/build/file-system.mdx b/zh/use-dify/build/file-system.mdx index 1fab4e71..ffe666b8 100644 --- a/zh/use-dify/build/file-system.mdx +++ b/zh/use-dify/build/file-system.mdx @@ -10,7 +10,7 @@ keyword: skills, skill 文件系统包含两类文件: -- **资源**:你提供的持久文件,例如技能(Skill)。 +- **资源**:你上传或创建的持久文件,例如技能(Skill)。 - **产物**:LLM 在每次运行期间生成的临时文件。 @@ -18,13 +18,15 @@ keyword: skills, skill ## 资源 -资源是你为工作流创建或导入的文件。LLM 可以读取但不能修改它们。资源在多次运行之间持久保存,并在导出应用时一起包含。 +资源是你为工作流创建或导入的文件。LLM 可以读取但不能修改它们。资源在应用中持久保存,并在导出应用时一起包含。 -### 技能(Skill) +### Skill -[技能(Skill)](https://agentskills.io/home)将指令、知识、脚本和其他参考资料打包用于特定任务——定义一次,跨工作流复用。 +[Skill](https://agentskills.io/home) 将指令、知识、脚本和其他资料打包用于特定任务——定义一次,跨工作流复用。 -例如,你无需每次都重复风格指南并上传品牌素材来让 LLM 生成营销文案,只需创建一个 `marketing-copy` Skill 并将所有内容包含在内,在需要时直接引用即可。 +例如,你无需每次重复描述风格指南并上传品牌素材来让 LLM 生成营销文案,只需创建一个 `marketing-copy` Skill 并将所有资料包含在内,需要时直接引用即可。 + +可以将 Skill 理解为一份详细的 SOP(标准作业程序),而 LLM 就像一位能力出色的新员工。新员工具备通用能力,但不了解公司的具体流程。Skill 为他们提供所需的一切——步骤说明、参考资料、可用工具——让他们能按照你期望的方式完成任务。 #### 创建或导入 Skill @@ -32,7 +34,7 @@ keyword: skills, skill 每个 Skill 都需要一个 `SKILL.md` 文件,定义任务内容、使用时机以及执行步骤。 -在 `SKILL.md` 中,你可以引用任何可用的资源——脚本、模板、上下文材料或 [Dify 工具](/zh/use-dify/workspace/tools)——并指定使用的时机和方式。 +在 `SKILL.md` 中,你可以引用任何可用的资源(脚本、模板、上下文材料或 [Dify 工具](/zh/use-dify/workspace/tools))并指定使用的场景和方式。 Skill @@ -40,7 +42,7 @@ keyword: skills, skill 在提示词编辑器中输入 `/`,然后从**文件**选项卡中选择一个 Skill 文件夹。 -LLM 会先读取 Skill 的 frontmatter(名称、描述和元数据),仅在需要时才加载完整内容。这节省了 Token 并提高了效率,尤其是在使用多个 Skill 时。 +LLM 会先读取 Skill 的头信息(名称、描述和元数据),仅在需要时才加载完整内容。这节省了 Token 并提高了效率,在使用多个 Skill 时尤其有用。 ## 产物 @@ -54,7 +56,7 @@ LLM 会先读取 Skill 的 frontmatter(名称、描述和元数据),仅在 - 产物在多次测试运行之间持久保存。要清除它们,请点击**变量检查**面板中的**全部重置**。 + 产物在多次测试运行之间持久保存。要清除它们,点击**变量检查**面板中的**全部重置**。 产物的范围限定在每次运行中,运行完成后自动清除。 @@ -69,13 +71,13 @@ LLM 会先读取 Skill 的 frontmatter(名称、描述和元数据),仅在 产物存储在沙盒环境中,无法直接暴露给终端用户。要输出产物,你需要通过另一个 Agent 节点来提取: -1. 在生成文件的节点下游添加一个 Agent 节点。 +1. 在生成文件的节点下游,添加一个 Agent 节点。 2. 关闭 **Agent 模式**并启用**结构化输出**。 3. 添加一个文件类型的结构化输出变量。 -4. 通过**添加对话历史**导入上游 Agent 的对话历史。这让 LLM 可以定位文件路径。 +4. 通过**添加对话历史**导入上游 Agent 节点的对话历史。这让模型可以定位文件路径。 5. 在用户消息中,指示模型提取并输出文件(例如"输出生成的 PDF 文件")。 @@ -83,7 +85,7 @@ LLM 会先读取 Skill 的 frontmatter(名称、描述和元数据),仅在 ## 支持的文件类型和操作 -文件系统中的所有文件都可以下载。部分文件还可以预览或编辑。 +文件系统中的所有文件都可下载。部分文件还可预览或编辑。 diff --git a/zh/use-dify/build/runtime.mdx b/zh/use-dify/build/runtime.mdx index 3d4969b3..60232213 100644 --- a/zh/use-dify/build/runtime.mdx +++ b/zh/use-dify/build/runtime.mdx @@ -17,7 +17,7 @@ Dify 提供两种运行时环境:**沙盒运行时**和**经典运行时**, **适用场景:** 需要 LLM 自主解决问题的复杂任务。功能更强大,但速度更慢、Token 消耗更高。 - 沙盒运行时使 LLM 能够在隔离环境中**执行命令**。你能在终端中用命令完成的任何操作,它们都能做到: + 沙盒运行时使 LLM 能够在隔离环境中**执行命令行**。你能在终端中用命令行完成的任何操作,它们都能做到: - **运行脚本和程序** - 执行代码来处理数据、生成输出或执行任意计算 @@ -25,17 +25,17 @@ Dify 提供两种运行时环境:**沙盒运行时**和**经典运行时**, - **访问外部资源** - 从 URL 获取文件、克隆仓库或从外部来源检索数据 - - **处理文件** - 访问[文件系统](/zh/use-dify/build/file-system)中的资源(如[技能(Skill)](/zh/use-dify/build/file-system#技能skill)),跨格式处理文件,并使用脚本和已安装工具生成多模态产物 + - **处理文件** - 访问[文件系统](/zh/use-dify/build/file-system)中的资源(如 [Skill](/zh/use-dify/build/file-system#skill)),处理不同格式的文件,并使用脚本和工具生成多模态产物 - 在沙盒运行时中,Agent 节点同时承担了 LLM 和 Agent 的角色。 + 在沙盒运行时中,Agent 节点同时承担了经典运行时中 LLM 和 Agent 节点的角色。 - 对于不需要这些高级功能的简单快速任务,可以关闭 **[Agent 模式](/zh/use-dify/nodes/agent#启用命令执行agent-模式)** 来获得更快的响应和更低的 Token 成本。 + 对于不需要这些高级功能的简单快速任务,可以关闭 **[Agent 模式](/zh/use-dify/nodes/agent#启用命令执行(agent-模式))** 来获得更快的响应和更低的 Token 消耗。 - **LLM 成为真正的 Agent**。只要模型具有强大的工具调用和推理能力,它就能自主决定运行什么命令并执行它们来完成任务。 + **LLM 成为真正的 Agent**。只要模型具有足够强大的工具调用和推理能力,它就能自主决定运行什么命令并执行它们来完成任务。 - LLM 的能力越强,就越需要在沙盒中运行。隔离环境在赋予它们足够自由度的同时,确保了安全运行。 + 正是因为 LLM 的能力变得更强,所以才需要在沙盒中运行。隔离环境赋予它们足够的自由度,也能确保安全运行。 默认沙盒提供商: @@ -44,19 +44,19 @@ Dify 提供两种运行时环境:**沙盒运行时**和**经典运行时**, - 自托管部署使用 SSH VM。 - 在**设置** > **沙盒提供商**中选择和配置其他提供商。 + 你可以在**设置** > **沙盒提供商**中选择和配置其他提供商。 - **适用场景:** 简单快速的任务。功能较少,但速度更快、效率更高。 + **适用场景:** 简单快速的任务。功能有限,但速度更快、效率更高。 - 在经典运行时中,LLM 做它们最擅长的事:分析信息、生成文本、推理问题,并智能地使用预配置的工具来完成任务。 + 在经典运行时中,LLM 做它们最擅长的事:分析信息、生成文本、推理问题,并自主使用预配置的工具来完成任务。 - 可以把它想象成给某人一套特定的工具包——他们很有能力,但**仅限于你提供的工具范围**。 + 可以把它想象成给某人一套特定的工具包——他们可以完成任务,但**仅限于你提供的工具范围**。 @@ -66,7 +66,7 @@ Dify 提供两种运行时环境:**沙盒运行时**和**经典运行时**, | 维度 | 沙盒运行时 | 经典运行时 | |:------------------------------|:-------------------------------------|:------------------------------------| | **适用场景** | 复杂的自主问题解决 | 简单、明确的任务 | -| **LLM 自主性** | 运行所需的任何命令 | 使用你配置的工具 | +| **LLM 自主程度** | 运行所需的任何命令行 | 使用你配置好的工具 | | **文件系统** | ✅ | ❌ | | **技能(Skill)** | ✅ | ❌ | | **应用导出格式** | `.zip`(DSL + 资源文件) | `.yml`(DSL 文件) | diff --git a/zh/use-dify/nodes/agent.mdx b/zh/use-dify/nodes/agent.mdx index 8d4cd327..18121945 100644 --- a/zh/use-dify/nodes/agent.mdx +++ b/zh/use-dify/nodes/agent.mdx @@ -1,6 +1,6 @@ --- title: "Agent" -description: "赋予 LLM 自主控制工具的能力,以执行复杂任务" +description: "让 LLMs 自主完成复杂任务" icon: "robot" --- @@ -9,9 +9,9 @@ icon: "robot" - 在[沙盒运行时](/zh/use-dify/build/runtime#沙盒运行时)中,Agent 节点赋予 LLM 自主执行命令的能力:调用工具、运行脚本、访问外部资源、操作[文件系统](/zh/use-dify/build/file-system)以及创建多模态输出。 + 在[沙盒运行时](/zh/use-dify/build/runtime#沙盒运行时)中,Agent 节点赋予 LLM 自主执行命令行的能力,使其可以调用工具、运行脚本、访问外部资源、操作[文件系统](/zh/use-dify/build/file-system)以及创建多模态输出。 - 这也带来了权衡:更长的响应时间和更高的 Token 消耗。要更快更高效地处理简单任务,可以关闭 **[Agent 模式](#启用命令执行agent-模式)** 来禁用这些功能。 + 这也带来了权衡:更长的响应时间和更高的 Token 消耗。要更快更高效地处理简单任务,可以关闭 **[Agent 模式](#启用命令执行(agent-模式))** 来禁用这些功能。 ## 选择模型 @@ -36,9 +36,9 @@ icon: "robot" ### 指定指令和消息 - 定义系统指令并点击**添加消息**来添加用户/助手消息。它们会按顺序在单个提示词中发送给模型。 + 定义系统指令并点击**添加消息**来添加用户/助手消息。它们会按顺序在提示词中发送给模型。 - 可以把它想象成直接与模型对话: + 想象你正在与模型直接对话: - **系统指令**设定模型响应的规则——角色、语气和行为准则。 @@ -50,13 +50,12 @@ icon: "robot" 在系统指令中定义角色和规则,然后在用户消息中传递实际的任务输入。例如: - ```bash wrap - # System instruction - You are a children's story writer. Write a story based on the user's input. Use simple language and a warm tone. + # 系统指令 + 你是一名儿童故事作家。根据用户输入写一个故事。使用简单的语言和温暖的语气。 - # User message - Write a bedtime story about a rabbit who makes friends with a shy hedgehog. + # 用户消息 + 写一个关于兔子和害羞的刺猬成为朋友的睡前故事。 ``` 虽然将所有内容放在系统指令中看起来更简单,但将角色定义与任务输入分离可以为模型提供更清晰的结构。 @@ -69,9 +68,9 @@ icon: "robot" ### 从上游 LLM 导入对话历史 - 点击**添加对话历史**,从上游 Agent 节点导入对话历史。这让模型了解上游发生了什么,并从该节点中断的地方继续。 + 点击**添加对话历史**,从上游 Agent 节点导入对话历史。这让模型了解上游发生了什么,并从其结束的地方继续。 - 对话历史包括**用户**消息、**助手**消息和**工具**消息。你可以在 Agent 节点的 `context` 输出变量中查看。 + 对话历史包括**用户**消息、**助手**消息和**工具**消息。你可以在 Agent 节点的 `context` 输出变量中查看。 系统指令不包含在内,因为它们是节点特定的。 @@ -87,72 +86,73 @@ icon: "robot" - 假设两个 Agent 节点按顺序运行:Agent A 分析数据并生成图表图片,保存到沙盒的输出文件夹。Agent B 创建包含这些图表的最终报告。 + 假设两个 Agent 节点依次运行:Agent A 分析数据并生成图表图片,保存到沙盒的输出文件夹。Agent B 创建包含这些图表的最终报告。 - 如果 Agent B 只接收 Agent A 的最终文本输出,它知道分析结论但不知道生成了什么文件或文件存储在哪里。 + 如果 Agent B 只接收 Agent A 的最终文本输出,它知道分析结论,但可能不知道生成了什么文件或文件存储在哪里。 通过导入 Agent A 的对话历史,Agent B 可以从工具消息中看到确切的文件路径,从而可以在报告中访问和嵌入这些图表。 以下是 Agent B 导入 Agent A 对话历史后看到的完整消息序列: ```bash wrap - # Agent B's own system instruction - 1. System: "You are a report designer. Create professional reports with embedded visuals." + # Agent B 的系统指令 + 1. System: "你是一名报告设计师。创建包含可视化内容的专业报告。" - # from Agent A - 2. User: "Analyze the Q3 sales data and create visualizations." + # 来自 Agent A + 2. User: "分析 Q3 销售数据并创建可视化图表。" - # from Agent A - 3. Tool: [bash] Created bar chart: /output/q3_sales_by_region.png - 4. Tool: [bash] Created trend line: /output/q3_monthly_trend.png + # 来自 Agent A + 3. Tool: [bash] 已创建柱状图:/output/q3_sales_by_region.png + 4. Tool: [bash] 已创建趋势线:/output/q3_monthly_trend.png - # from Agent A - 5. Assistant: "I've analyzed the Q3 sales data and created two charts..." + # 来自 Agent A + 5. Assistant: "我已分析 Q3 销售数据并创建了两个图表..." - # Agent B's own user message - 6. User: "Create a PDF report incorporating the generated charts." + # Agent B 的用户消息 + 6. User: "创建包含已生成图表的 PDF 报告。" ``` - Agent B 确切地知道哪些文件存在以及它们的位置,因此可以直接将它们嵌入报告。 + 通过导入 Agent A 的对话历史,Agent B 可以确切地知道哪些文件存在以及它们的位置,因此可以直接将它们嵌入报告。 - 在示例 1 的基础上,假设你想将生成的 PDF 报告交付给终端用户。由于产物无法直接暴露给终端用户,你需要第三个 Agent 节点来提取文件。 + 在示例 1 的基础上,假设你想将生成的 PDF 报告输出给终端用户下载。由于产物无法直接暴露给终端用户,你需要第三个 Agent 节点来提取文件。 Agent C 配置: - - **Agent 模式**:已关闭 + - **Agent 模式**:关闭 - - **结构化输出**:已启用,包含一个文件类型的输出变量 + - **结构化输出**:启用,添加一个文件类型的输出变量 - **对话历史**:从 Agent B 导入 - - **用户消息**:"Output the generated PDF." + - **用户消息**:"输出生成的 PDF 文件。" 以下是 Agent C 导入 Agent B 对话历史后看到的完整消息序列: - ```bash wrap - # Agent C's own system instruction (optional) - 1. System: (none) - # User and tool messages from Agent A (omitted for brevity) + ```bash wrap + # Agent C 的系统指令(可选) + 1. System:(无) + + # 来自 Agent A 的用户和工具消息(为简洁起见省略) 2. ... - # from Agent B - 3. User: "Create a PDF report incorporating the generated charts." + # 来自 Agent B + 3. User: "创建包含已生成图表的 PDF 报告。" - # from Agent B - 4. Tool: [bash] Created report: /output/q3_sales_report.pdf + # 来自 Agent B + 4. Tool: [bash] 已创建报告:/output/q3_sales_report.pdf - # from Agent B - 5. Assistant: "I've created a PDF report with the charts embedded..." + # 来自 Agent B + 5. Assistant: "我已创建包含图表的 PDF 报告……" - # Agent C's own user message - 6. User: "Output the generated PDF." + # Agent C 的用户消息 + 6. User: "输出生成的 PDF。" ``` - Agent C 从导入的对话历史中定位文件路径,并将其作为文件变量输出。然后你可以在回答节点或输出节点中引用该变量,将文件交付给终端用户。 + Agent C 从导入的对话历史中定位文件路径,并将其作为文件变量输出。然后,你可以在回答节点或输出节点中引用该变量,将文件交付给终端用户。 @@ -162,53 +162,53 @@ icon: "robot" ```jinja2 wrap - You are a - {% if user_level == "beginner" %}patient and friendly - {% elif user_level == "intermediate" %}professional and efficient - {% else %}senior expert-level - {% endif %} assistant. + 你是一个 + {% if user_level == "beginner" %}耐心友好 + {% elif user_level == "intermediate" %}专业高效 + {% else %}资深专家级 + {% endif %} 的助手。 {% if user_level == "beginner" %} - Please explain in simple and easy-to-understand language. Provide examples when necessary. Avoid using technical jargon. - {% elif user_level == "intermediate" %} You may use some technical terms, but provide appropriate explanations. Offer practical advice and best practices. - {% else %} You may delve into technical details and use professional terminology. Focus on advanced use cases and optimization solutions. + 请用简单易懂的语言解释,必要时提供示例。避免使用技术术语。 + {% elif user_level == "intermediate" %} 你可以使用一些技术术语,但需提供适当解释。提供实用建议和最佳实践。 + {% else %} 你可以深入技术细节并使用专业术语。重点关注高级用例和优化方案。 {% endif %} ``` - 默认情况下,你需要将所有可能的指令发送给模型,描述条件,然后让模型自行决定遵循哪些——这种方法通常不可靠。 + 默认情况下,你需要将所有可能的指令发送给模型,描述条件,然后让模型自行决定遵循哪些——这种方法往往不够可靠。 使用 Jinja2 模板,只有符合定义条件的指令会被发送,确保行为可预测并减少 Token 使用。 ## 启用命令执行(Agent 模式) - 开启 **Agent 模式**,让模型使用内置的 bash 工具在沙盒运行时中执行命令。 + 开启 **Agent 模式**,让模型使用内置的 bash 工具在沙盒运行时中执行命令行。 - 这是所有高级功能的基础:当模型调用其他 Dify 工具、执行文件操作、运行脚本或访问外部资源时,它都是通过调用 bash 工具来执行底层命令。 + 这是所有高级功能的基础:当模型调用其他任何工具、执行文件操作、运行脚本或访问外部资源时,它都是通过调用 bash 工具来执行底层的命令行。 - 对于不需要这些功能的简单快速任务,可以关闭 **Agent 模式** 以获得更快的响应和更低的 Token 成本。 + 对于不需要这些功能的简单快速任务,可以关闭 **Agent 模式** 以获得更快的响应和更低的 Token 消耗。 **调整最大迭代次数** **高级设置**中的**最大迭代次数**限制了模型对单次请求可以重复其推理-行动循环(思考、调用工具、处理结果)的次数。 - 对于需要多次工具调用的复杂多步任务,增加此值。较高的值会增加延迟和 Token 成本。 + 对于需要多次工具调用的复杂多步任务,增加此值。较高的值会增加延迟和 Token 消耗。 ## 启用对话记忆(仅对话流) - 记忆是节点特定的,不会在不同对话之间持久保存。 + 记忆是节点特定的,仅在同一个对话中生效。 启用**记忆**以保留最近的对话,使 LLM 能够连贯地回答后续问题。 - 会自动添加一条用户消息来传递当前用户查询和任何上传的文件。这是因为记忆通过存储最近的用户-助手交互来工作。如果用户查询没有通过用户消息传递,用户侧将没有内容可记录。 + 一条用户消息会被自动添加来传递用户输入和任何上传的文件。这是因为记忆通过存储最近的用户-助手消息交互来工作。如果用户输入不通过用户消息传递,用户侧将没有内容可记录。 - **窗口大小**控制保留多少条最近的交互。例如,`5` 保留最近 5 轮用户查询和 LLM 响应。 + **窗口大小**控制保留多少条最近的交互。例如,`5` 保留最近 5 轮用户输入和 LLM 回复。 ## 添加上下文 - 在**高级设置** > **上下文**中,为 LLM 提供额外的参考信息以减少幻觉并提高响应准确性。 + 在**高级设置** > **上下文**中,为 LLM 提供额外的参考信息,以减少幻觉并提高响应准确性。 典型模式:从知识检索节点[传递检索结果](/zh/use-dify/nodes/knowledge-retrieval#与-llm-节点搭配使用),实现检索增强生成(RAG)。 @@ -226,25 +226,25 @@ icon: "robot" - **低**:对简单图片处理更快,消耗更少 Token - 对于不具备相关多模态能力的模型,使用**[上传文件至沙盒](/zh/use-dify/nodes/upload-file-to-sandbox)**节点将文件上传到沙盒。Agent 节点随后可以执行命令来安装工具和运行脚本处理这些文件——即使是模型原生不支持的文件类型。 + 对于不具备相关多模态能力的模型,可以使用[上传文件至沙盒](/zh/use-dify/nodes/upload-file-to-sandbox)节点将文件上传到沙盒。Agent 节点随后可以执行命令行来安装工具和运行脚本处理这些文件——即使是模型原生不支持的文件类型。 - ## 将思考过程和工具调用与响应分离 + ## 将思考过程和工具调用与回复分离 - 要获得不包含模型思考过程和工具调用的干净响应,请使用 `generations.content` 输出变量。 + 若要获得不包含模型思考过程和工具调用的干净回复,请引用 `generations.content` 输出变量。 - `generations` 变量本身包含所有中间步骤和最终响应。 + `generations` 变量本身包含所有中间步骤和最终回复。 ## 强制结构化输出 - 在指令中描述输出格式可能产生不一致的结果。要获得更可靠的格式化,启用结构化输出以强制执行定义好的 JSON schema。 + 在指令中描述输出格式可能产生不一致的结果。若要实现更可靠的格式化,启用结构化输出以强制执行定义好的 JSON schema。 - 对于不支持原生 JSON 的模型,Dify 会将 schema 包含在提示词中,但不保证严格遵循。 + 对于不支持原生 JSON 的模型,Dify 会将 schema 包含在提示词中,但模型不一定严格遵循。 结构化输出 - 1. 在**输出变量**旁,开启**结构化**开关。一个 `structured_output` 变量将出现在输出变量列表末尾。 + 1. 在**输出变量**旁,启用**结构化**开关。一个 `structured_output` 变量将出现在输出变量列表末尾。 2. 点击**配置**,使用以下方法之一定义输出 schema。 @@ -257,12 +257,12 @@ icon: "robot" - **JSON 导入**:粘贴一个现有的 JSON 对象,自动生成对应的 schema。 - 使用文件类型的结构化输出变量从沙盒中提取产物,使其可供终端用户使用。详见[向终端用户输出产物](/zh/use-dify/build/file-system#向终端用户输出产物)。 + 可使用文件类型的结构化输出变量从沙盒中提取产物,供终端用户下载。详见[向终端用户输出产物](/zh/use-dify/build/file-system#向终端用户输出产物)。 ## 错误处理 - 为临时问题(如网络波动)配置自动重试,并设置备用错误处理策略以在错误持续时保持工作流运行。 + 为临时问题(如网络波动)配置自动重试,或设置备用错误处理策略以在错误持续时保持工作流运行。 错误处理 diff --git a/zh/use-dify/nodes/command.mdx b/zh/use-dify/nodes/command.mdx index 37076eb9..a2744539 100644 --- a/zh/use-dify/nodes/command.mdx +++ b/zh/use-dify/nodes/command.mdx @@ -1,5 +1,6 @@ --- title: 命令执行 +description: 在工作流中直接执行 shell 命令 icon: "rectangle-terminal" --- @@ -9,8 +10,6 @@ icon: "rectangle-terminal" 此节点仅在使用沙盒运行时的应用中可用。 -使用命令执行节点在工作流中直接执行 Shell 命令。 +虽然 Agent 节点可以自主执行命令行,但当你明确知道要运行什么命令且不需要 LLM 推理时,命令执行节点是更好的选择。它们更快且不消耗 Token。 -虽然 Agent 节点可以自主执行命令,但当你明确知道要运行什么命令且不需要 LLM 推理时,命令执行节点是更好的选择。它们更快且不消耗 Token。 - -命令默认在根目录运行。要使用不同的工作目录,输入一个已有路径或一个将在执行过程中由上游节点创建的路径。 +命令默认在根目录运行。若要使用不同的工作目录,输入一个已有路径或一个将在执行过程中由上游节点创建的路径。 diff --git a/zh/use-dify/nodes/knowledge-retrieval.mdx b/zh/use-dify/nodes/knowledge-retrieval.mdx index 1c1d1ab8..26d215da 100644 --- a/zh/use-dify/nodes/knowledge-retrieval.mdx +++ b/zh/use-dify/nodes/knowledge-retrieval.mdx @@ -115,10 +115,10 @@ icon: "database" 2. 在系统指令中,引用 `Context` 变量。 -3. 可选:如果 LLM 支持视觉能力,启用 **Vision** 以便其处理检索结果中的图片附件。 +3. 可选:如果 LLM 支持视觉能力,启用 **视觉** 以便其处理检索结果中的图片附件。 - 你无需指定任何视觉输入变量。启用 **Vision** 后,LLM 会自动访问检索到的图片。 + 你无需将检索结果变量指定为视觉输入。启用 **视觉** 后,LLM 会自动访问检索到的图片。 -在对话流中,默认情况下引用知识的响应旁会显示引用来源。你可以在**功能**中关闭**引用和归属**来禁用此功能。 +在对话流中,默认情况下引用知识的响应旁会显示引用来源。你可以在画布右上角的**功能**中关闭**引用和归属**来禁用此功能。 diff --git a/zh/use-dify/nodes/llm.mdx b/zh/use-dify/nodes/llm.mdx index a4572805..1b6cda08 100644 --- a/zh/use-dify/nodes/llm.mdx +++ b/zh/use-dify/nodes/llm.mdx @@ -1,6 +1,6 @@ --- title: "LLM" -description: "调用大语言模型进行文本生成和分析" +description: "调用大语言模型进行文本生成和分析,或使用工具完成复杂任务" icon: "brain" --- @@ -31,9 +31,9 @@ LLM 节点调用大语言模型,根据你的指令和上游节点的输入生 ### 指定指令和消息 -定义系统指令并点击**添加消息**来添加用户/助手消息。它们会按顺序在单个提示词中发送给模型。 +定义系统指令并点击**添加消息**来添加用户/助手消息。它们会按顺序在提示词中发送给模型。 -可以把它想象成直接与模型对话: +想象你正在与模型直接对话: - **系统指令**设定模型响应的规则——角色、语气和行为准则。 @@ -46,11 +46,11 @@ LLM 节点调用大语言模型,根据你的指令和上游节点的输入生 在系统指令中定义角色和规则,然后在用户消息中传递实际的任务输入。例如: ```bash wrap -# System instruction -You are a children's story writer. Write a story based on the user's input. Use simple language and a warm tone. +# 系统指令 +你是一名儿童故事作家。根据用户输入写一个故事。使用简单的语言和温暖的语气。 -# User message -Write a bedtime story about a rabbit who makes friends with a shy hedgehog +# 用户消息 +写一个关于兔子和害羞的刺猬成为朋友的睡前故事。 ``` 虽然将所有内容放在系统指令中看起来更简单,但将角色定义与任务输入分离可以为模型提供更清晰的结构。 @@ -63,7 +63,7 @@ Write a bedtime story about a rabbit who makes friends with a shy hedgehog ### 从上游 LLM 导入对话历史 -点击**添加对话历史**,从上游 Agent 或 LLM 节点导入对话历史。这让模型了解上游发生了什么,并从该节点中断的地方继续。 +点击**添加对话历史**,从上游 Agent 或 LLM 节点导入对话历史。这让模型了解上游发生了什么,并从其结束的地方继续。 对话历史包括**用户**消息、**助手**消息和**工具**消息。你可以在 Agent 或 LLM 节点的 `context` 输出变量中查看。 @@ -81,30 +81,30 @@ Write a bedtime story about a rabbit who makes friends with a shy hedgehog - 假设两个 LLM 节点按顺序运行:LLM A 通过调用搜索工具研究一个主题,LLM B 基于研究结果撰写报告。 + 假设两个 LLM 节点依次运行:LLM A 通过调用搜索工具研究一个主题,LLM B 基于研究结果撰写报告。 - 如果 LLM B 只接收 LLM A 的最终文本输出,它可以总结结论但无法验证或引用具体来源。通过导入 LLM A 的对话历史,LLM B 可以看到每次工具调用的原始数据,并在报告中直接引用。 + 如果 LLM B 只接收 LLM A 的最终文本输出,它可以总结结论,但可能无法验证或引用具体来源。通过导入 LLM A 的对话历史,LLM B 可以看到每次工具调用的原始数据,并在报告中直接引用。 以下是 LLM B 导入 LLM A 对话历史后看到的完整消息序列: ```bash wrap - # LLM B's own system instruction - 1. System: "You are a professional report writer..." + # LLM B 自己的系统指令 + 1. System: "你是一名专业的报告撰写者..." - # from LLM A - 2. User: "What are the new trends in the EV market?" + # 来自 LLM A + 2. User: "电动车(EV)市场的新趋势是什么?" - # from LLM A - 3. Tool: [search results with URLs and raw data] + # 来自 LLM A + 3. Tool: [包含 URL 和原始数据的搜索结果] - # from LLM A - 4. Assistant: "Based on the search results, the key trends are..." + # 来自 LLM A + 4. Assistant: "根据搜索结果,关键趋势是..." - # LLM B's own user message - 5. User: "Write a 500-word market analysis report." + # LLM B 自己的用户消息 + 5. User: "撰写一份 500 字的市场分析报告。" ``` - LLM B 理解:它已经看到了研究过程(问题、搜索、总结),现在需要基于这些信息撰写报告——包括仅通过文本输出无法获取的原始数据。 + 导入对话历史后,LLM B 就能理解:它已经看到了研究过程(问题、搜索、总结),现在需要基于这些信息撰写报告——包括仅通过文本输出无法获取的原始数据。 @@ -114,55 +114,53 @@ Write a bedtime story about a rabbit who makes friends with a shy hedgehog ```jinja2 wrap -You are a -{% if user_level == "beginner" %}patient and friendly -{% elif user_level == "intermediate" %}professional and efficient -{% else %}senior expert-level -{% endif %} assistant. +你是一个 +{% if user_level == "beginner" %}耐心友好 +{% elif user_level == "intermediate" %}专业高效 +{% else %}资深专家级 +{% endif %} 的助手。 {% if user_level == "beginner" %} -Please explain in simple and easy-to-understand language. Provide examples when necessary. Avoid using technical jargon. -{% elif user_level == "intermediate" %} You may use some technical terms, but provide appropriate explanations. Offer practical advice and best practices. -{% else %} You may delve into technical details and use professional terminology. Focus on advanced use cases and optimization solutions. +请用简单易懂的语言解释,必要时提供示例。避免使用技术术语。 +{% elif user_level == "intermediate" %} 你可以使用一些技术术语,但需提供适当解释。提供实用建议和最佳实践。 +{% else %} 你可以深入技术细节并使用专业术语。重点关注高级用例和优化方案。 {% endif %} - -User question: {{ query }} ``` -默认情况下,你需要将所有可能的指令发送给模型,描述条件,然后让模型自行决定遵循哪些——这种方法通常不可靠。 +默认情况下,你需要将所有可能的指令发送给模型,描述条件,然后让模型自行决定遵循哪些——这种方法往往不够可靠。 使用 Jinja2 模板,只有符合定义条件的指令会被发送,确保行为可预测并减少 Token 使用。 ## 添加上下文 -在**高级设置** > **上下文**中,为 LLM 提供额外的参考信息以减少幻觉并提高响应准确性。 +在**高级设置** > **上下文**中,为 LLM 提供额外的参考信息,以减少幻觉并提高响应准确性。 典型模式:从知识检索节点[传递检索结果](/zh/use-dify/nodes/knowledge-retrieval#与-llm-节点搭配使用),实现检索增强生成(RAG)。 ## 启用对话记忆(仅对话流) - 记忆是节点特定的,不会在不同对话之间持久保存。 + 记忆是节点特定的,仅在同一个对话中生效。 启用**记忆**以保留最近的对话,使 LLM 能够连贯地回答后续问题。 -会自动添加一条用户消息来传递当前用户查询和任何上传的文件。这是因为记忆通过存储最近的用户-助手交互来工作。如果当前查询没有通过用户消息传递,用户侧将没有内容可记录。 +一条用户消息会被自动添加来传递用户输入和任何上传的文件。这是因为记忆通过存储最近的用户-助手消息交互来工作。如果用户输入不通过用户消息传递,用户侧将没有内容可记录。 -**窗口大小**控制保留多少条最近的交互。例如,`5` 保留最近 5 轮用户查询和 LLM 响应。 +**窗口大小**控制保留多少条最近的交互。例如,`5` 保留最近 5 轮用户输入和 LLM 回复。 -## 添加 Dify 工具 +## 调用 Dify 工具 - 只有带有 Tool Call 标签的模型才能使用 Dify 工具。 + 只有带有 Tool Call 标签的模型才能调用 Dify 工具。 Tool Call 标签 -添加 [Dify 工具](/zh/use-dify/workspace/tools)让模型与外部服务和 API 交互。当任务需要实时数据或超出文本生成范围的操作(如网页搜索或数据库查询)时非常有用。 +添加 [Dify 工具](/zh/use-dify/workspace/tools)让模型与外部服务和 API 交互,以完成需要查询实时数据或超出文本生成范围的任务(如网页搜索或数据库查询)。 你可以禁用或删除已添加的工具,并修改其配置。更清晰的工具描述有助于模型判断何时使用它。 @@ -188,21 +186,21 @@ User question: {{ query }} ## 将思考过程和工具调用与响应分离 -要获得不包含模型思考过程和工具调用(如果有)的干净响应,请引用 `text` 输出变量(开启**启用推理标签分离**)或 `generation.content`。 +若要获得不包含模型思考过程和工具调用(如果有)的干净响应,请引用 `text` 输出变量(开启**启用推理标签分离**)或 `generation.content`。 `generations` 变量本身包含所有中间步骤和最终响应。 ## 强制结构化输出 -在指令中描述输出格式可能产生不一致的结果。要获得更可靠的格式化,启用结构化输出以强制执行定义好的 JSON schema。 +在指令中描述输出格式可能产生不一致的结果。若要实现更可靠的格式化,启用结构化输出以强制执行定义好的 JSON schema。 - 对于不支持原生 JSON 的模型,Dify 会将 schema 包含在提示词中,但不保证严格遵循。 + 对于不支持原生 JSON 的模型,Dify 会将 schema 包含在提示词中,但模型不一定严格遵循。 结构化输出 -1. 在**输出变量**旁,开启**结构化**开关。一个 `structured_output` 变量将出现在输出变量列表末尾。 +1. 在**输出变量**旁,启用**结构化**开关。一个 `structured_output` 变量将出现在输出变量列表末尾。 2. 点击**配置**,使用以下方法之一定义输出 schema。 @@ -216,6 +214,6 @@ User question: {{ query }} ## 错误处理 -为临时问题(如网络波动)配置自动重试,并设置备用错误处理策略以在错误持续时保持工作流运行。 +为临时问题(如网络波动)配置自动重试,或设置备用错误处理策略以在错误持续时保持工作流运行。 - 错误处理 +错误处理 diff --git a/zh/use-dify/nodes/tools.mdx b/zh/use-dify/nodes/tools.mdx index 412d36cf..913310f9 100644 --- a/zh/use-dify/nodes/tools.mdx +++ b/zh/use-dify/nodes/tools.mdx @@ -32,8 +32,8 @@ icon: "wrench" | 方式 | 适用场景 | 工作原理 | |:---------|:---------|:-------------------| -| **组装变量** | 数据在上游输出中直接可用且结构清晰,但需要重新格式化、提取或组合 |
  1. 你描述需求。
  2. 系统自动创建一个内部**代码**节点来处理转换。
| -| **从 LLM 的对话历史中提取** | 数据嵌入在 LLM 的对话历史中,需要 LLM 来解读和提取 |
  1. 你描述需求。
  2. 系统自动创建一个内部 **LLM** 节点来读取所选 Agent 或 LLM 节点的对话历史并提取所需数据。
| +| **组装变量** | 数据在上游输出中直接可用且结构清晰,但需要格式转换、提取或组合 |
  1. 你描述需求。
  2. 系统自动创建一个内部**代码**节点来处理转换。
| +| **从 LLM 的对话历史中提取** | 数据隐藏在 LLM 的对话历史中,需要 LLM 来解读和提取 |
  1. 你描述需求。
  2. 系统自动创建一个内部 **LLM** 节点来读取所选 Agent 或 LLM 节点的对话历史并提取所需数据。
| ### 组装变量 @@ -45,7 +45,7 @@ icon: "wrench" 三个上游 LLM 节点各自生成了一段产品描述。下游工具需要一个包含所有描述的单一数组。 -选择**组装变量**并描述:"Combine the text outputs from LLM1, LLM2, and LLM3." +选择**组装变量**并描述:"组合 LLM1、LLM2 和 LLM3 的文本输出。" 系统生成的代码会将输出合并为工具期望的数组格式。 @@ -72,7 +72,7 @@ icon: "wrench" - 要稍后重新打开**组装变量**界面: + 之后如需重新打开**组装变量**界面: 1. 点击已组装变量旁的**查看内部**。 2. 选择内部代码节点。 @@ -83,15 +83,15 @@ icon: "wrench" 从 LLM 的对话历史中提取 -当你需要的信息嵌入在 LLM 的对话历史中时使用——即执行过程中产生的用户、助手和工具消息。你可以通过 LLM 的 `context` 输出变量查看其对话历史。 +当你需要的信息隐藏在 LLM 的对话历史(即执行过程中产生的用户、助手和工具消息)中时使用。你可以通过 LLM 的 `context` 输出变量查看其对话历史。 上游 LLM 节点生成了代码,但其输出包含自然语言的解释和注释。下游的代码解释器工具需要纯净的、可执行的代码。 -无需修改上游 LLM 让它只输出代码,在代码解释器的输入字段中 `@` 该 LLM 节点并描述:"Extract the executable code only." +无需修改上游 LLM 让它只输出代码,而是在代码解释器的输入字段中 `@` 该 LLM 节点并描述:"仅输出可执行的代码。" -系统创建一个内部 LLM 节点,读取所选 LLM 节点的对话历史,并以代码解释器期望的格式提取代码部分。 +系统将创建一个内部 LLM 节点,自动添加所选 LLM 节点的对话历史,并以代码解释器期望的格式提取代码。 @@ -101,9 +101,9 @@ icon: "wrench" 1. 在任何接受变量的输入字段中,输入 `@` 并选择一个上游 Agent 或 LLM 节点。 -2. 描述你想从其对话历史中提取什么。 +2. 描述你想从其对话历史中提取的内容。 -3. 点击**查看内部**并测试运行内部 LLM 节点。该节点导入上游节点的对话历史,并使用结构化输出来匹配所需格式。 +3. 点击**查看内部**并测试运行内部 LLM 节点。该节点自动导入上游节点的对话历史,并使用结构化输出来匹配所需格式。 4. 检查输出并根据需要优化。 diff --git a/zh/use-dify/nodes/upload-file-to-sandbox.mdx b/zh/use-dify/nodes/upload-file-to-sandbox.mdx index 4cb8d69e..1308aac7 100644 --- a/zh/use-dify/nodes/upload-file-to-sandbox.mdx +++ b/zh/use-dify/nodes/upload-file-to-sandbox.mdx @@ -1,6 +1,6 @@ --- title: "上传文件至沙盒" -description: "将多模态文件上传至沙盒,让 LLM 可以使用工具和脚本处理它们——即使是模型原生不支持的文件类型" +description: "将多模态文件上传至沙盒,让 LLM 可以使用工具和脚本自主处理——即使是模型原生不支持的文件类型" icon: "upload" --- @@ -10,29 +10,29 @@ icon: "upload" 此节点仅在使用沙盒运行时的应用中可用。 -当文件直接传递给 LLM 时,处理能力受限于模型自身的多模态能力。虽然[文档提取](/zh/use-dify/nodes/doc-extractor)节点可以将各种文件类型转换为文本供 LLM 处理,但其支持的格式仍然有限。 +当文件直接传递给 LLM 时,处理效果受限于模型自身的多模态能力。虽然[文档提取](/zh/use-dify/nodes/doc-extractor)节点可以将许多文件类型转换为文本供 LLM 处理,但其支持的格式仍然有限。 -这就是"上传文件至沙盒"节点的用武之地。文件上传后,下游的 [Agent 节点](/zh/use-dify/nodes/agent#沙盒运行时)(启用了 **Agent 模式**)可以执行命令来安装工具和运行脚本,将文件转换为 LLM 可处理的格式。 +这就是上传文件至沙盒节点的用武之地。文件上传至沙盒后,下游的 [Agent 节点](/zh/use-dify/nodes/agent#沙盒运行时)(启用 **Agent 模式**)可以通过命令行在沙盒中安装工具和运行脚本,将文件转换为 LLM 可处理的格式。 - - 处理结果取决于模型的推理能力。 - - 在生产环境中,这些上传的文件范围限定在每次运行中,不会在沙盒中持久保存。 + - 处理效果取决于模型的推理能力。 + - 在生产环境中,这些上传的文件仅在单次运行中可用,不会在沙盒中持久保存。 **使用方法:** -1. 在"上传文件至沙盒"节点中,选择一个文件变量(例如来自用户输入的变量)。支持 `file` 和 `array[file]` 数据类型。 +1. 在上传文件至沙盒节点中,选择一个文件变量(例如来自用户输入的变量)。支持 `file` 和 `array[file]` 数据类型。 2. 在下游 Agent 节点的提示词中,引用 `sandbox_path` 和 `file_name` 变量,以便模型定位和处理文件。例如: ```bash wrap - # System instruction - You are a data analyst. Analyze uploaded data files and provide insights. + # 系统指令 + 你是一名数据分析师。分析上传的数据文件并提供见解。 - # User message - Analyze the data in "{{Upload File to Sandbox.file_name}}" at {{Upload File to Sandbox.sandbox_path}}. + # 用户消息 + 分析 {{Upload File to Sandbox.file_name}} 中的数据,文件位于 {{Upload File to Sandbox.sandbox_path}}。 ``` - `file_name` 变量还包含文件扩展名(例如 `data.csv`)。 + `file_name` 变量包含文件扩展名(例如 `data.csv`)。 diff --git a/zh/use-dify/publish/publish-to-marketplace.mdx b/zh/use-dify/publish/publish-to-marketplace.mdx index ca825e0c..d9fcbb60 100644 --- a/zh/use-dify/publish/publish-to-marketplace.mdx +++ b/zh/use-dify/publish/publish-to-marketplace.mdx @@ -1,32 +1,32 @@ --- title: "发布到市场" sidebarTitle: "市场" -description: "将你的工作流发布到 Dify 市场,与全世界分享" +description: "将你的应用发布到 Dify 市场,与全世界分享" icon: "store" --- ⚠️ 本文档由 AI 自动翻译。如有任何不准确之处,请参考[英文原版](/en/use-dify/publish/publish-to-marketplace)。 -将你的工作流和对话流应用作为模板发布到 Dify 市场,让其他 Dify 用户可以发现和使用。如果你已加入 [Affiliate Program](https://dify.ai/affiliate-program),还可以从模板中获得收益。 +将你的应用作为模板发布到 Dify 市场,让其他 Dify 用户可以发现和使用。如果你加入[联盟计划](https://dify.ai/affiliate-program),还可以从模板中获得收益。 ## 提交模板 -要发布模板,需要先提交审核。审核通过后,模板将在市场上架。 +若要发布模板,需先提交审核。通过后,模板将在市场上架。 有两种提交方式: - 在画布上,点击**发布** > **发布到市场**。 + 在应用内部,点击**发布** > **发布到市场**。 - 这将跳转到 [Creators Platform](),你可以在此填写模板详情并提交审核。 + 这将跳转到 [创作者中心](https://creators.dify.dev/),你可以在此填写模板详情并提交审核。 - - 导出你的应用,然后前往 [Creators Platform]() 上传导出文件。填写模板详情并提交审核。 + + 导出你的应用,然后前往 [创作者中心](https://creators.dify.dev/) 上传导出文件。填写模板详情并提交审核。 -## 模板撰写指南 +## 模板填写指南 ### 语言要求 @@ -34,46 +34,45 @@ icon: "store" **以下字段必须使用英文撰写**: - - Template name(模板名称) - - Overview(概述) - - Setup steps(设置步骤) + - 模板名称 + - 概述 + - 设置步骤 -**在工作流内部,你可以使用任何语言(如中文)来编写**: +**在应用内部,你可以使用任何语言(如中文)来编写**: - 节点名称 - 提示词 / 系统消息 - 展示给终端用户的消息 -如果你的模板主要面向非英语用户,可以在标题中添加标签。例如: -Stock Investment Analysis Copilot [ZH]。 +如果你的模板主要面向非英语用户,可以在标题中添加标签。例如:Stock Investment Analysis Copilot [ZH]。 -### Template Name & Icon +### 模板名称和图标 仅从名称,用户就应该知道它在哪里运行以及做什么。 -- Use a short English phrase, typically 3-7 words. -- Recommended pattern: [Channel / target] + [core task], for example: +- 使用简短的英文短语,通常为 3-7 个单词。 +- 推荐模式:[渠道 / 目标] + [核心任务],例如: - WeChat Customer Support Bot - CSV Data Analyzer with Natural Language - Internal Docs Q&A Assistant - GitHub Issue Triage Agent -- Include keywords users might search for: channel names (Slack, WeChat, Email, Notion) and task names (Summarizer, Assistant, Generator, Bot). +- 包含用户可能搜索的关键词:渠道名称 (Slack, WeChat, Email, Notion) 和任务名称 (Summarizer, Assistant, Generator, Bot)。 -### Categories +### 分类 帮助用户在浏览或按分类筛选时发现你的模板。 - 仅选择 1-3 个最能描述你模板的分类。 - 不要为了增加曝光而勾选所有分类。 -### Language +### 语言 帮助用户通过语言筛选发现你的模板。 - 选择你的模板在实际使用中所面向的语言。 -- 这里指的是模板用例、输入或输出的语言——**而非**标题或概述的语言(这些必须使用英文)。 +- 这里指的是模板用例、输入或输出的语言,**而非**标题或概述的语言(这些必须使用英文)。 -### Overview +### 概述 用 2-4 句英文说明它做什么以及面向谁。 @@ -86,7 +85,7 @@ Stock Investment Analysis Copilot [ZH]。 2. 第 2-3 句:面向谁、什么场景 典型用户角色或场景(客服团队、营销人员、创始人、个人知识工作者等)。 - + This template creates a stock investment analysis copilot that uses Yahoo Finance tools to fetch news, analytics, and ticker data for any listed company. @@ -94,28 +93,29 @@ It helps investors and analysts quickly generate structured research summaries, -### Setup Steps +### 设置步骤 -将 Setup steps 写成 Markdown 编号列表(1., 2., 3.),每一步用简短的一句话,以动词开头。 +将设置步骤写成 Markdown 编号列表(1., 2., 3.),每一步用简短的一句话,以动词开头。 新用户只需按照这些步骤操作,即可在几分钟内让模板运行起来。 **撰写原则** 1. 按照实际设置顺序,通常为: - 1. Use/import the template - 2. Connect accounts / add API keys - 3. Connect data sources (docs, databases, sheets, etc.) - 4. Optional customization (assistant name, tone, filters) - 5. Activate the workflow and run a test + 1. 使用/导入模板 + 2. 连接账户 / 添加 API 密钥 + 3. 连接数据源 (文档、数据库、表格等) + 4. 可选自定义 (助手名称、语气、过滤器) + 5. 激活工作流并运行测试 2. 每一步应回答: - - 在 UI 中点击哪里 + - 在界面中点击哪里 - 需要配置或填写什么 -3. 目标 3-8 步。太少显得不完整,太多显得令人生畏。 +3. 目标 3-8 步。太少显得不完整,太多则会令人生畏。 + + - 1. Click **Use template** to copy the "Investment Analysis Copilot (Yahoo Finance)" agent into your workspace. 2. Go to **Settings → Model provider** and add your LLM API key. For example, OpenAI, Anthropic, or another supported provider. @@ -137,9 +137,9 @@ It helps investors and analysts quickly generate structured research summaries, ### 提交前快速检查清单 - 标题是一个简短的英文短语,能清楚地说明它在哪里运行、做什么。 -- Overview 用 2-4 句英文解释价值和典型用例。 +- 概述用 2-4 句英文解释价值和典型用例。 - 仅选择了 1-3 个相关分类。 -- Setup steps 是清晰的编号列表。 +- 设置步骤是清晰的、用英文撰写的编号列表。 - 工作流内部的文本和提示词使用了面向目标用户的适当语言。 diff --git a/zh/use-dify/workspace/tools.mdx b/zh/use-dify/workspace/tools.mdx index 383f17b3..7ac4d0f2 100644 --- a/zh/use-dify/workspace/tools.mdx +++ b/zh/use-dify/workspace/tools.mdx @@ -1,5 +1,6 @@ --- -title: 工具 +title: Dify 工具 +sidebarTitle: 工具 icon: "wrench" --- @@ -9,7 +10,7 @@ Dify 工具使 LLM 能够与外部服务和 API 交互,从而访问实时数 每个工具都有清晰的接口:它接受什么输入、执行什么操作以及返回什么输出。这有助于 LLM 根据用户请求判断何时以及如何调用工具。 -工具可在以下场景中使用: +工具可在以下应用类型中使用: - 工作流 / 对话流应用(作为独立的工具节点,或在 LLM / Agent 节点内使用)