diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 9e187d1e0..95190e994 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -134,6 +134,11 @@ export default defineConfig({ { text: "修改对话流水线", link: "/zh/deploy/pipelines/readme", + collapsed: true, + items: [ + { text: "Dify", link: "/zh/deploy/pipelines/dify" }, + { text: "n8n", link: "/zh/deploy/pipelines/n8n" }, + ], }, { text: "系统环境设置", @@ -168,10 +173,6 @@ export default defineConfig({ { text: "实践", items: [ - { - text: "如何接入 Dify?", - link: "/zh/workshop/dify-service-api", - }, { text: "如何实现一个消息平台适配器?", link: "/zh/workshop/impl-platform-adapter", @@ -326,6 +327,11 @@ export default defineConfig({ { text: "Modify Dialogue Pipeline", link: "/en/deploy/pipelines/readme", + collapsed: true, + items: [ + { text: "Dify", link: "/en/deploy/pipelines/dify" }, + { text: "n8n", link: "/en/deploy/pipelines/n8n" }, + ], }, { text: "System Settings", @@ -359,10 +365,6 @@ export default defineConfig({ { text: "Workshops", items: [ - { - text: "How to Integrate with Dify?", - link: "/en/workshop/dify-service-api", - }, { text: "How to Implement a Message Platform Adapter?", link: "/en/workshop/impl-platform-adapter", diff --git a/docs/assets/image/zh/workshop/dify-service-api/dify_sv_api_01.png b/docs/assets/image/zh/deploy/pipelines/dify/dify_sv_api_01.png similarity index 100% rename from docs/assets/image/zh/workshop/dify-service-api/dify_sv_api_01.png rename to docs/assets/image/zh/deploy/pipelines/dify/dify_sv_api_01.png diff --git a/docs/assets/image/zh/deploy/pipelines/dify/dify01.png b/docs/assets/image/zh/deploy/pipelines/dify/dify_sv_api_02.png similarity index 100% rename from docs/assets/image/zh/deploy/pipelines/dify/dify01.png rename to docs/assets/image/zh/deploy/pipelines/dify/dify_sv_api_02.png diff --git a/docs/assets/image/zh/workshop/dify-service-api/dify_workflow_output_key.png b/docs/assets/image/zh/deploy/pipelines/dify/dify_workflow_output_key.png similarity index 100% rename from docs/assets/image/zh/workshop/dify-service-api/dify_workflow_output_key.png rename to docs/assets/image/zh/deploy/pipelines/dify/dify_workflow_output_key.png diff --git a/docs/assets/image/zh/deploy/pipelines/n8n/config_auth.png b/docs/assets/image/zh/deploy/pipelines/n8n/config_auth.png new file mode 100644 index 000000000..0916ed18e Binary files /dev/null and b/docs/assets/image/zh/deploy/pipelines/n8n/config_auth.png differ diff --git a/docs/assets/image/zh/deploy/pipelines/n8n/config_respond.png b/docs/assets/image/zh/deploy/pipelines/n8n/config_respond.png new file mode 100644 index 000000000..7ef995112 Binary files /dev/null and b/docs/assets/image/zh/deploy/pipelines/n8n/config_respond.png differ diff --git a/docs/assets/image/zh/deploy/pipelines/n8n/config_webhook.png b/docs/assets/image/zh/deploy/pipelines/n8n/config_webhook.png new file mode 100644 index 000000000..d8f6c811e Binary files /dev/null and b/docs/assets/image/zh/deploy/pipelines/n8n/config_webhook.png differ diff --git a/docs/assets/image/zh/deploy/pipelines/n8n/create_wf.png b/docs/assets/image/zh/deploy/pipelines/n8n/create_wf.png new file mode 100644 index 000000000..a9d19af63 Binary files /dev/null and b/docs/assets/image/zh/deploy/pipelines/n8n/create_wf.png differ diff --git a/docs/en/workshop/dify-service-api.md b/docs/en/deploy/pipelines/dify.md similarity index 92% rename from docs/en/workshop/dify-service-api.md rename to docs/en/deploy/pipelines/dify.md index 7c3b3a03f..a145acac0 100644 --- a/docs/en/workshop/dify-service-api.md +++ b/docs/en/deploy/pipelines/dify.md @@ -11,7 +11,7 @@ Please follow the [Dify documentation](https://docs.dify.ai) to deploy Dify and After publishing your application, go to the `Access API` page of your application to generate an API key. -![Dify Application API Key](/assets/image/zh/workshop/dify-service-api/dify_sv_api_01.png) +![Dify Application API Key](/assets/image/zh/deploy/pipelines/dify/dify_sv_api_01.png) Save the API server and API key for configuring LangBot's pipeline `AI Capability`. @@ -26,14 +26,14 @@ The above is an example for Dify cloud service version. If you are using the sel Open the LangBot WebUI page, add a new pipeline or switch to the AI capability configuration page in an existing pipeline. -![Setting Development Item](/assets/image/zh/deploy/pipelines/dify/dify01.png) +![Setting Development Item](/assets/image/zh/deploy/pipelines/dify/dify_sv_api_02.png) ::: info ### Workflow Output Key If you are using a Dify workflow application, please use `summary` as the key to pass the output content. -![Dify Workflow Application Output Key](/assets/image/zh/workshop/dify-service-api/dify_workflow_output_key.png) +![Dify Workflow Application Output Key](/assets/image/zh/deploy/pipelines/dify/dify_workflow_output_key.png) ## Output Processing diff --git a/docs/en/deploy/pipelines/n8n.md b/docs/en/deploy/pipelines/n8n.md new file mode 100644 index 000000000..3511900e0 --- /dev/null +++ b/docs/en/deploy/pipelines/n8n.md @@ -0,0 +1,27 @@ +# Using n8n with LangBot + +[n8n](https://n8n.io/) is an open-source workflow automation platform that allows you to create, schedule, and execute various automated tasks. + +LangBot currently supports triggering workflows and receiving responses through the `Webhook` node in n8n workflows. + +## Configuring n8n Workflow Connection + +![n8n Workflow](/assets/image/zh/deploy/pipelines/n8n/create_wf.png) + +You need to select `Webhook` as the trigger and configure it according to the image below: + +![n8n webhook configuration](/assets/image/zh/deploy/pipelines/n8n/config_webhook.png) + +:::info +Authentication corresponds to the authentication methods in LangBot's pipeline configuration, which you can modify as needed. + +![n8n workflow configuration](/assets/image/zh/deploy/pipelines/n8n/config_auth.png) +::: + +For the workflow response content in n8n, please use the `Respond to Webhook` node and configure it according to the image below: + +![n8n workflow response configuration](/assets/image/zh/deploy/pipelines/n8n/config_respond.png) + +The response content key name in `Response Body` needs to match the `output key name` in LangBot's pipeline configuration. + +After completing the n8n workflow configuration, please click `Active` at the top to enable the workflow. \ No newline at end of file diff --git a/docs/en/deploy/pipelines/readme.md b/docs/en/deploy/pipelines/readme.md index a5c226a39..3f0fa87ea 100644 --- a/docs/en/deploy/pipelines/readme.md +++ b/docs/en/deploy/pipelines/readme.md @@ -14,7 +14,7 @@ The current pipeline can be configured with the following features: ## AI Capabilities -You can choose to use: regular large language model `Built-in Agent`, [`Dify`](https://dify.ai/), [`Alibaba Cloud Bailian`](https://www.aliyun.com/product/bailian?source=5176.29345612&userCode=ys4ad8gs) +You can choose to use: `Built-in Agent`, [`Dify`](https://dify.ai/), [`n8n`](https://n8n.io/) AI capabilities are mainly divided into two parts: selecting the runner and configuring runner parameters. @@ -24,15 +24,15 @@ The runner defines how to schedule the large model to process messages. The defa edit_pipeline -You can also choose to use external LLMOps platforms such as `Dify`, [`Alibaba Cloud Bailian`](https://www.aliyun.com/product/bailian?source=5176.29345612&userCode=ys4ad8gs). In this case, the models, prompts, tools, and other resources used will be provided by the LLMOps platform. +You can also choose to use external LLMOps platforms such as `Dify`, [`n8n`](https://n8n.io/). In this case, the models, prompts, tools, and other resources used will be provided by the LLMOps platform. more_runner -- For detailed steps on connecting to Dify, you can [refer to the tutorial](/en/workshop/dify-service-api.html). +- For detailed steps on connecting to Dify, you can [refer to the tutorial](/en/deploy/pipelines/dify.html). +- For detailed steps on connecting to n8n, you can [refer to the tutorial](/en/deploy/pipelines/n8n.html). ### Conversation Variables - -When using Dify or Alibaba Cloud Bailian, LangBot explicitly passes the following parameters, which you can add to the start node of the Dify workflow: +When using external LLMOps platforms, LangBot explicitly passes the following parameters, which you can add to the start node of the LLMOps platform workflow (the image below is an example of Dify): - `user_message_text`: The plain text of the user message - `session_id`: User session ID, `person_` for private chat, `group_` for group chat diff --git a/docs/zh/workshop/dify-service-api.md b/docs/zh/deploy/pipelines/dify.md similarity index 89% rename from docs/zh/workshop/dify-service-api.md rename to docs/zh/deploy/pipelines/dify.md index 4cc04225a..66206dd02 100644 --- a/docs/zh/workshop/dify-service-api.md +++ b/docs/zh/deploy/pipelines/dify.md @@ -11,7 +11,7 @@ LangBot 目前支持`聊天助手`(含Chatflow)、`Agent`、`工作流`三 发布应用后,在应用的 `访问API` 页面,生成 API 密钥。 -![Dify 应用 API 密钥](/assets/image/zh/workshop/dify-service-api/dify_sv_api_01.png) +![Dify 应用 API 密钥](/assets/image/zh/deploy/pipelines/dify/dify_sv_api_01.png) 保存 API 服务器和 API 密钥,在 LangBot 的流水线的`AI 能力`配置。 @@ -26,14 +26,14 @@ LangBot 目前支持`聊天助手`(含Chatflow)、`Agent`、`工作流`三 打开 LangBot WebUI 页面,添加一个新的流水线或在已有流水线中切换到 AI 能力配置页面。 -![设置开发项](/assets/image/zh/deploy/pipelines/dify/dify01.png) +![设置开发项](/assets/image/zh/deploy/pipelines/dify/dify_sv_api_02.png) ::: info ### 工作流输出键 如果使用的是 Dify 的工作流应用,那么请使用 `summary` 作为键传递输出内容。 -![Dify 工作流应用的输出键](/assets/image/zh/workshop/dify-service-api/dify_workflow_output_key.png) +![Dify 工作流应用的输出键](/assets/image/zh/deploy/pipelines/dify/dify_workflow_output_key.png) ## 输出处理 diff --git a/docs/zh/deploy/pipelines/n8n.md b/docs/zh/deploy/pipelines/n8n.md new file mode 100644 index 000000000..c4a9dfd47 --- /dev/null +++ b/docs/zh/deploy/pipelines/n8n.md @@ -0,0 +1,27 @@ +# 在 LangBot 上使用 n8n + +[n8n](https://n8n.io/) 是一款开源的自动化工作流平台,可以创建、调度、执行各种自动化任务。 + +LangBot 目前支持通过 n8n 工作流的 `Webhook` 节点,来触发工作流并获取回复。 + +## 配置 n8n 工作流连接 + +![n8n 工作流](/assets/image/zh/deploy/pipelines/n8n/create_wf.png) + +需要选择`Webhook`触发,并参考下图配置: + +![n8n webhook 配置](/assets/image/zh/deploy/pipelines/n8n/config_webhook.png) + +:::info +Authentication 对应 LangBot 流水线配置中的几种鉴权方式,可自行更改。 + +![n8n 工作流配置](/assets/image/zh/deploy/pipelines/n8n/config_auth.png) +::: + +n8n 的工作流响应内容请使用`Respond to Webhook`节点,并参考下图配置: + +![n8n 工作流响应配置](/assets/image/zh/deploy/pipelines/n8n/config_respond.png) + +`Response Body`中的响应内容键名需要与 LangBot 流水线配置中的`输出键名`一致。 + +在完成 n8n 工作流的配置之后,请在其顶部点击`Active`以启用工作流。 \ No newline at end of file diff --git a/docs/zh/deploy/pipelines/readme.md b/docs/zh/deploy/pipelines/readme.md index 669452d10..d1b3b874c 100644 --- a/docs/zh/deploy/pipelines/readme.md +++ b/docs/zh/deploy/pipelines/readme.md @@ -14,7 +14,7 @@ LangBot 首次启动时会自动创建一个默认的流水线。创建机器人 ## AI 能力 -可以选择使用:普通大语言模型`内置 Agent`、[`Dify`](https://dify.ai/)、[`阿里云百炼`](https://www.aliyun.com/product/bailian?source=5176.29345612&userCode=ys4ad8gs) +可以选择使用:`内置 Agent`、[`Dify`](https://dify.ai/)、[`阿里云百炼`](https://www.aliyun.com/product/bailian?source=5176.29345612&userCode=ys4ad8gs)、[`n8n`](https://n8n.io/) AI 能力主要分为两个部分,选择运行器和配置运行器参数。 @@ -24,15 +24,16 @@ AI 能力主要分为两个部分,选择运行器和配置运行器参数。 edit_pipeline -您也可以选择使用 `Dify`、 [`阿里云百炼`](https://www.aliyun.com/product/bailian?source=5176.29345612&userCode=ys4ad8gs) 等外部 LLMOps 平台,这种情况下所使用的模型和提示词、工具等资源将由 LLMOps 平台提供。 +您也可以选择使用 `Dify`、 [`n8n`](https://n8n.io/) 等外部 LLMOps 平台,这种情况下所使用的模型和提示词、工具等资源将由 LLMOps 平台提供。 more_runner -- 接入 Dify 的详细步骤可以[参考教程](/zh/workshop/dify-service-api.html)。 +- 接入 Dify 的详细步骤可以[参考教程](/zh/deploy/pipelines/dify.html)。 +- 接入 n8n 的详细步骤可以[参考教程](/zh/deploy/pipelines/n8n.html)。 ### 对话变量 -当使用 Dify 或者阿里云百炼时,LangBot 会显式传入以下参数,您可以自行在 Dify 工作流的开始节点中添加: +当使用外部 LLMOps 平台时,LangBot 会显式传入以下参数,您可以自行在 LLMOps 平台的开始节点中添加(下图以 Dify 为例): - `user_message_text`:用户消息的纯文本 - `session_id`:用户会话id,私聊为 `person_`,群聊为 `group_`