doc: 添加dify配置方式

This commit is contained in:
Junyan Qin
2024-12-14 18:09:53 +08:00
parent f846da080c
commit bc68402566
2 changed files with 40 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

+40
View File
@@ -170,3 +170,43 @@
`role` 为消息的角色,可以是`user`(用户)、`assistant`(AI)、`system`(系统)
`content` 为字符串,表示消息内容。
在使用中通过`!default set <文件名>`指令将其设为默认(将<预设名>整体替换)
## 请求运行器 runner
```json
"runner": "local-agent",
```
设置聊天消息将由哪个运行器处理,默认是 `local-agent`
目前支持:
- `local-agent`:LangBot 本地实现的一个 Agent 机制,实现会话管理、插件调用。需要设置为 local-agent 才能使用`内容函数`。
- `dify-service-api`:使用 [Dify](https://dify.ai/) 的 Service API 机制,支持 聊天助手、Agent、工作流应用。
## Dify Service API 配置
```json
"dify-service-api": {
"base-url": "https://api.dify.ai/v1",
"app-type": "chat",
"chat": {
"api-key": "app-1234567890"
},
"workflow": {
"api-key": "app-1234567890",
"output-key": "summary"
}
}
```
仅在 `runner` 设置为 `dify-service-api` 时,需要配置以下内容:
- `base-url`:Dify Service API 的地址,默认是 `https://api.dify.ai/v1`,这是 Dify 官方云服务的地址,如果你使用的是自部署的社区版,请设置为你的自部署地址。
- `app-type`:使用的 Dify 应用类型。支持 `chat` 和 `workflow`,`chat`:聊天助手(含高级编排)和 Agent;`workflow`:工作流;请填写下方对应的应用类型 API 参数
- `chat`:Dify 聊天助手应用的配置
- `api-key`:Dify 聊天助手应用的 API 密钥
- `workflow`:Dify 工作流应用的配置
- `api-key`:Dify 工作流应用的 API 密钥
- `output-key`:Dify 工作流应用的输出键,用于获取工作流应用的输出结果。默认为`summary`,对应工作流编排时,end节点的输出变量。
![Dify 工作流应用的输出键](/assets/image/config_provider_01.png)