mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
doc: update langbot doc for 4.0
This commit is contained in:
@@ -4,7 +4,7 @@ title: 将 Dify 快速接入 QQ、微信、飞书、钉钉等平台
|
||||
|
||||
## 1. 概述
|
||||
|
||||
市面上有多种多样的 IM 平台,接入机器人的方法各不相同,使用难度也参差不齐,导致难以快速接入 Dify 等 LLMOps 平台,使用 Dify 的强大生态。而借助 [LangBot](https://github.com/RockChinQ/LangBot),即可在短时间内将 Dify 接入到 QQ、微信、飞书、钉钉、Telegram、Discord 等平台提供服务。同时,LangBot 还提供扩展机制和丰富的生态,能更加灵活地满足需求。
|
||||
市面上有多种多样的 IM 平台,接入机器人的方法各不相同,使用难度也参差不齐,导致难以快速接入 Dify 等 LLMOps 平台,使用 Dify 的强大生态。而借助 [LangBot](https://github.com/RockChinQ/LangBot),即可在短时间内将 Dify 接入到 QQ、微信、飞书、钉钉、Telegram、Discord、Slack 等平台提供服务。同时,LangBot 还提供扩展机制和丰富的生态,能更加灵活地满足需求。
|
||||
|
||||
## 2. 部署 LangBot
|
||||
|
||||
@@ -12,72 +12,24 @@ title: 将 Dify 快速接入 QQ、微信、飞书、钉钉等平台
|
||||
|
||||
你可以通过以下三种方式部署 LangBot:
|
||||
|
||||
1. Docker 部署:[对应链接](https://docs.langbot.app/deploy/langbot/docker.html)
|
||||
2. 手动部署:[对应链接](https://docs.langbot.app/deploy/langbot/one-click/bt.html)
|
||||
3. 使用宝塔面板部署:[对应链接](https://docs.langbot.app/deploy/langbot/manual.html)
|
||||
1. Docker 部署:[对应链接](https://docs.langbot.app/zh/deploy/langbot/docker.html)
|
||||
2. 手动部署:[对应链接](https://docs.langbot.app/zh/deploy/langbot/manual.html)
|
||||
3. 使用宝塔面板部署:[对应链接](https://docs.langbot.app/zh/deploy/langbot/one-click/bt.html)
|
||||
|
||||
### 2.2. 对接消息平台
|
||||
|
||||
参考[此页面](https://docs.langbot.app/deploy/platforms/readme.html),选择你要用的消息平台,如 QQ、微信、飞书、钉钉、Telegram、Discord等。
|
||||
参考[此页面](https://docs.langbot.app/zh/deploy/platforms/readme.html),选择你要用的消息平台,如 QQ、微信、飞书、钉钉、Telegram、Discord等。
|
||||
|
||||
## 3. 接入 Dify
|
||||
|
||||
在首次运行 LangBot 后,会在 LangBot 目录生成 data 文件夹,打开其中的 `config/provider.json` 文件,设置其中的 `runner` 为 `dify-service-api`。
|
||||
LangBot 使用`流水线`控制对消息的处理。首次启动时,LangBot 会自动创建一个默认流水线,请到流水线配置页面,点击打开流水线配置。
|
||||
选择`AI 能力`页,将运行器切换成`Dify 服务 API`。
|
||||
|
||||
```json
|
||||
"runner": "dify-service-api",
|
||||
```
|
||||

|
||||
|
||||
相应的,配置 `dify-service-api`:
|
||||
在其中填写您的 Dify 服务的 API 接口地址、Dify 应用类型和 API Key,完成后即可在即时通信软件上与机器人对话。
|
||||
|
||||
```json
|
||||
"dify-service-api": {
|
||||
"base-url": "https://api.dify.ai/v1",
|
||||
"app-type": "chat",
|
||||
"options": {
|
||||
"convert-thinking-tips": "original"
|
||||
},
|
||||
"chat": {
|
||||
"api-key": "app-1234567890",
|
||||
"timeout": 120
|
||||
},
|
||||
"agent": {
|
||||
"api-key": "app-1234567890",
|
||||
"timeout": 120
|
||||
},
|
||||
"workflow": {
|
||||
"api-key": "app-1234567890",
|
||||
"output-key": "summary",
|
||||
"timeout": 120
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `base-url`:Dify Service API 的地址,默认是 `https://api.dify.ai/v1`,这是 Dify 官方云服务的地址,如果你使用的是自部署的社区版,请设置为你的自部署地址。
|
||||
|
||||
- `app-type`:使用的 Dify 应用类型。支持 `chat` - 聊天助手(含 Chatflow)、 `agent` - Agent、 `workflow` - 工作流;请填写下方对应的应用类型 API 参数
|
||||
|
||||
- `options`:特殊的选项配置。
|
||||
- `convert-thinking-tips`:dify 使用 deepseek-r1 等有思维链的模型时[会携带思考过程回复](https://github.com/RockChinQ/LangBot/issues/1108),此选项控制输出时的处理方式;值为 original 时,不转换思考提示;值为 plain 时,将思考提示转换为类似 DeepSeek 官方的<think>...</think>格式;值为 remove 时,删除思考提示
|
||||
|
||||
-
|
||||
chat:Dify 聊天助手(或 chatflow)应用的配置
|
||||
|
||||
- `api-key`:Dify 聊天助手应用的 API 密钥
|
||||
- `timeout`:Dify 聊天助手应用的请求超时时间,以秒为单位,默认是 120 秒。
|
||||
|
||||
-
|
||||
agent:Dify Agent 应用的配置
|
||||
|
||||
- `api-key`:Dify Agent 应用的 API 密钥
|
||||
- `timeout`:Dify Agent 应用的请求超时时间,以秒为单位,默认是 120 秒。
|
||||
|
||||
-
|
||||
workflow:Dify 工作流应用的配置
|
||||
|
||||
- `api-key`:Dify 工作流应用的 API 密钥
|
||||
- `output-key`:Dify 工作流应用的输出键,用于获取工作流应用的输出结果。默认为`summary`,对应工作流编排时,end节点的输出变量。
|
||||
- `timeout`:Dify 工作流应用的请求超时时间,以秒为单位,默认是 120 秒。
|
||||
使用工作流应用时,请使用`summary`作为键传回工作流运行结果。
|
||||
|
||||

|
||||
|
||||
@@ -88,12 +40,11 @@ title: 将 Dify 快速接入 QQ、微信、飞书、钉钉等平台
|
||||
- `conversation_id`:字符串,用户会话id,由 LangBot 生成。用户重置会话后,会重新生成
|
||||
- `msg_create_time`:数字类型,收到此消息的时间戳(秒)
|
||||
|
||||
您可以[通过插件自定义任何变量](https://docs.langbot.app/plugin/dev/api-ref.html#设置请求变量)
|
||||
您可以[通过插件自定义任何变量](https://docs.langbot.app/zh/plugin/dev/api-ref.html#设置请求变量)
|
||||
|
||||

|
||||
|
||||
使用 工作流 应用或 Agent 应用时,如果开启了`platform.json`中的`track-function-calls`,将会在 Dify 执行每个工具调用时,输出一个`调用函数xxx`的消息给用户。
|
||||
但如果是使用`chat`应用下的`ChatFlow`(聊天助手->工作流编排),无论如何只会输出 Answer(直接回复)节点返回的文本。
|
||||
- 详细的说明请查看 LangBot 文档
|
||||
|
||||
## 4. 效果展示
|
||||
|
||||
|
||||
Reference in New Issue
Block a user