diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 7924a515f..940831e45 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -5,227 +5,6 @@ export default defineConfig({ themeConfig: { logo: "/langbot-logo-0.5x.png", - nav: [ - { text: "主页", link: "https://langbot.app" }, - { text: "路线图", link: "https://langbot.featurebase.app/roadmap" }, - ], - - sidebar: [ - { - text: "概述", - items: [ - { text: "新手指引(必看)", link: "/insight/guide" }, - { text: "项目介绍", link: "/insight/intro" }, - { text: "社区资源", link: "/insight/community" }, - ], - }, - { - text: "部署", - items: [ - { - text: "部署 LangBot", - collapsed: true, - items: [ - { text: "Docker部署", link: "/deploy/langbot/docker" }, - { text: "宝塔面板部署", link: "/deploy/langbot/one-click/bt" }, - { text: "手动部署", link: "/deploy/langbot/manual" }, - ], - }, - { - text: "连接消息平台", - collapsed: true, - items: [ - { - text: "消息平台说明", - link: "/deploy/platforms/readme", - }, - { - text: "QQ 个人号", - collapsed: true, - items: [ - { - text: "NapCat", - link: "/deploy/platforms/qq/aiocqhttp/napcat", - }, - { - text: "Lagrange", - link: "/deploy/platforms/qq/aiocqhttp/lagrange", - }, - { - text: "llonebot", - link: "/deploy/platforms/qq/aiocqhttp/llonebot", - }, - { - text: "go-cqhttp", - link: "/deploy/platforms/qq/gocq", - }, - ], - }, - { - text: "QQ 官方机器人", - // link: "/deploy/platforms/qq/official", - collapsed: true, - items: [ - { - text: "Webhook 方式", - link: "/deploy/platforms/qq/official_webhook", - }, - { - text: "WebSocket 方式", - link: "/deploy/platforms/qq/official", - }, - ], - }, - { text: "个人微信", - collapsed: true, - items: [ - { - text: "Gewechat", - link: "/deploy/platforms/wechat/gewechat", - }, - ], - }, - { text: "企业微信", - collapsed: true, - items: [ - { - text: "内部应用", - link: "/deploy/platforms/wecom/wecom", - }, - { - text: "对外客服", - link: "/deploy/platforms/wecom/wecomcs", - }, - ], - }, - { text:"微信公众号",link:"/deploy/platforms/wxoa.md"}, - { text: "飞书", link: "/deploy/platforms/lark" }, - { text:"钉钉",link:"/deploy/platforms/dingtalk.md"}, - { text: "Discord", link: "/deploy/platforms/discord" }, - { text: "Telegram", link: "/deploy/platforms/telegram" }, - { text:"Slack", link: "/deploy/platforms/slack"}, - ], - }, - { text: "填写配置信息", link: "/deploy/quick-config/config" }, - { - text: "网络配置详解", - link: "/deploy/network-details", - }, - { - text: "更新 LangBot", - link: "/deploy/update", - }, - ], - }, - { - text: "使用", - items: [ - { text: "命令用法", link: "/usage/command" }, - { text: "常见问题", link: "/usage/faq" }, - ], - }, - { - text: "配置", - items: [ - { - text: "功能配置", - collapsed: true, - items: [ - { text: "platform.json", link: "/config/function/platform" }, - { text: "pipeline.json", link: "/config/function/pipeline" }, - { text: "provider.json", link: "/config/function/provider" }, - { text: "command.json", link: "/config/function/command" }, - { text: "system.json", link: "/config/function/system" }, - ], - }, - { - text: "元数据配置", - collapsed: true, - items: [ - { - text: "敏感词sensitive-words.json", - link: "/config/metadata/sensitive-words", - }, - { - text: "模型列表llm-models.json", - link: "/config/metadata/llm-models", - }, - { - text: "qq-botpy ID 映射 adapter-qq-botpy.json", - link: "/config/metadata/adapter-qq-botpy", - }, - ], - }, - ], - }, - { - text: "插件", - // collapsed: true, - items: [ - { text: "插件介绍", link: "/plugin/plugin-intro" }, - { - text: "插件开发", - collapsed: true, - items: [ - { text: "基础教程", link: "/plugin/dev/tutor" }, - { text: "消息平台实体", link: "/plugin/dev/messages" }, - { text: "API 参考", link: "/plugin/dev/api-ref" }, - { text: "组件扩展", link: "/plugin/dev/extension" }, - ], - }, - // { text: "技术信息", link: "/plugin/tech-info" }, - ], - }, - { - text: "管理面板(Beta测试)", - items: [ - { text: "介绍 & 使用", link: "/webui/intro" }, - { text: "系统操作", link: "/webui/system" }, - { text: "设置项管理", link: "/webui/settings" }, - ], - }, - { - text: "实践", - items: [ - { - text: "如何接入 Dify?", - link: "/workshop/dify-service-api", - }, - { - text: "如何接入 Dify? - NewAPI 中转方案", - link: "/workshop/dify-integration", - }, - { - text: "如何接入 OneAPI、LinkAI 等第三方 OpenAI 格式接口?", - link: "/workshop/one-api", - }, - { - text:"如何使用 Ollama 接入本地模型", - link:"/workshop/ollama" - }, - { - text: "如何实现一个消息平台适配器?", - link: "/workshop/impl-platform-adapter", - }, - { - text: "在 LangBot 接入完整 MCP 生态", - link: "/workshop/mcp-details" - }, - { - text: "接入 PPIO API", - link: "/workshop/ppio-integration" - } - ], - }, - { - text: "开发", - items: [ - { text: "开发配置", link: "/develop/dev-config" }, - { text: "组件架构", link: "/develop/comp-arch" }, - ], - }, - ], - // 编辑链接 editLink: { pattern: @@ -240,17 +19,15 @@ export default defineConfig({ locales: { root: { + title: "LangBot 文档", label: "简体中文", lang: "zh", link: "/zh/", themeConfig: { // https://vitepress.dev/reference/default-theme-config - nav: [ - { text: "首页", link: "/zh/" }, - { text: "概述", link: "/zh/insight/guide" }, - { text: "部署", link: "/zh/deploy/langbot/manual" }, - { text: "插件", link: "/zh/plugin/plugin-intro" }, + { text: "主页", link: "https://langbot.app" }, + { text: "路线图", link: "https://langbot.featurebase.app/roadmap" }, ], sidebar: [ @@ -258,65 +35,105 @@ export default defineConfig({ text: "概述", items: [ { text: "新手指引(必看)", link: "/zh/insight/guide" }, - { text: "项目介绍", link: "/zh/insight/intro" }, { text: "社区资源", link: "/zh/insight/community" }, ], }, { - text: "部署", + text: "部署和使用", items: [ { text: "部署 LangBot", collapsed: true, items: [ + { text: "Docker部署", link: "/zh/deploy/langbot/docker" }, { text: "宝塔面板部署", link: "/zh/deploy/langbot/one-click/bt", }, - { text: "Docker部署", link: "/zh/deploy/langbot/docker" }, { text: "手动部署", link: "/zh/deploy/langbot/manual" }, ], }, { - text: "部署消息平台", + text: "配置机器人", collapsed: true, + link: "/zh/deploy/platforms/readme", items: [ { - text: "aiocqhttp(推荐)", + text: "QQ 个人号", collapsed: true, items: [ { text: "NapCat", - link: "/zh/deploy/platforms/aiocqhttp/napcat", + link: "/zh/deploy/platforms/qq/aiocqhttp/napcat", }, { text: "Lagrange", - link: "/zh/deploy/platforms/aiocqhttp/lagrange", + link: "/zh/deploy/platforms/qq/aiocqhttp/lagrange", }, { text: "llonebot", - link: "/zh/deploy/platforms/aiocqhttp/llonebot", + link: "/zh/deploy/platforms/qq/aiocqhttp/llonebot", }, { - text: "shamrock", - link: "/zh/deploy/platforms/aiocqhttp/shamrock", + text: "go-cqhttp", + link: "/zh/deploy/platforms/qq/gocq", }, ], }, { - text: "go-cqhttp", - link: "/zh/deploy/platforms/gocq", + text: "QQ 官方机器人", + // link: "/deploy/platforms/qq/official", + collapsed: true, + items: [ + { + text: "Webhook 方式", + link: "/zh/deploy/platforms/qq/official_webhook", + }, + { + text: "WebSocket 方式", + link: "/zh/deploy/platforms/qq/official", + }, + ], }, { - text: "QQ官方", - link: "/zh/deploy/platforms/official", + text: "个人微信", + collapsed: true, + items: [ + { + text: "Gewechat", + link: "/zh/deploy/platforms/wechat/gewechat", + }, + ], }, + { + text: "企业微信", + collapsed: true, + items: [ + { + text: "内部应用", + link: "/zh/deploy/platforms/wecom/wecom", + }, + { + text: "对外客服", + link: "/zh/deploy/platforms/wecom/wecomcs", + }, + ], + }, + { text: "微信公众号", link: "/zh/deploy/platforms/wxoa.md" }, + { text: "飞书", link: "/zh/deploy/platforms/lark" }, + { text: "钉钉", link: "/zh/deploy/platforms/dingtalk.md" }, + { text: "Discord", link: "/zh/deploy/platforms/discord" }, + { text: "Telegram", link: "/zh/deploy/platforms/telegram" }, + { text: "Slack", link: "/zh/deploy/platforms/slack" }, ], }, - { text: "填写配置信息", link: "/zh/deploy/quick-config/config" }, { - text: "网络配置详解", - link: "/zh/deploy/network-details", + text: "配置对话模型", + link: "/zh/deploy/models/readme", + }, + { + text: "修改对话流水线", + link: "/zh/deploy/pipelines/readme", }, { text: "更新 LangBot", @@ -324,56 +141,6 @@ export default defineConfig({ }, ], }, - { - text: "使用", - items: [ - { text: "命令用法", link: "/zh/usage/command" }, - { text: "常见问题", link: "/zh/usage/faq" }, - ], - }, - { - text: "配置", - items: [ - { - text: "功能配置", - collapsed: true, - items: [ - { - text: "platform.json", - link: "/zh/config/function/platform", - }, - { - text: "pipeline.json", - link: "/zh/config/function/pipeline", - }, - { - text: "provider.json", - link: "/zh/config/function/provider", - }, - { text: "command.json", link: "/zh/config/function/command" }, - { text: "system.json", link: "/zh/config/function/system" }, - ], - }, - { - text: "元数据配置", - collapsed: true, - items: [ - { - text: "敏感词sensitive-words.json", - link: "/zh/config/metadata/sensitive-words", - }, - { - text: "模型列表llm-models.json", - link: "/zh/config/metadata/llm-models", - }, - { - text: "qq-botpy ID 映射 adapter-qq-botpy.json", - link: "/zh/config/metadata/adapter-qq-botpy", - }, - ], - }, - ], - }, { text: "插件", // collapsed: true, @@ -391,15 +158,6 @@ export default defineConfig({ }, ], }, - { - text: "管理面板(Beta测试)", - items: [ - { text: "介绍 & 使用", link: "/zh/webui/intro" }, - { text: "系统操作", link: "/zh/webui/system" }, - { text: "设置项管理", link: "/zh/webui/settings" }, - ], - }, - { text: "实践", items: [ @@ -407,23 +165,38 @@ export default defineConfig({ text: "如何接入 Dify?", link: "/zh/workshop/dify-service-api", }, - { - text: "如何接入 Dify? - NewAPI 中转方案", - link: "/zh/workshop/dify-integration", - }, { text: "如何接入 OneAPI、LinkAI 等第三方 OpenAI 格式接口?", link: "/zh/workshop/one-api", }, + { + text: "如何使用 Ollama 接入本地模型", + link: "/zh/workshop/ollama" + }, { text: "如何实现一个消息平台适配器?", link: "/zh/workshop/impl-platform-adapter", }, + { + text: "在 LangBot 接入完整 MCP 生态", + link: "/zh/workshop/mcp-details" + }, + { + text: "使用 PPIO 提供的模型", + link: "/zh/workshop/ppio-integration" + }, + { + text: "容器网络配置详解", + link: "/zh/workshop/network-details", + }, ], }, { text: "开发", - items: [{ text: "组件架构", link: "/zh/develop/comp-arch" }], + items: [ + { text: "开发配置", link: "/zh/develop/dev-config" }, + { text: "组件架构", link: "/zh/develop/comp-arch" }, + ], }, ], @@ -437,7 +210,7 @@ export default defineConfig({ socialLinks: [ { icon: "github", - link: "https://github.com/the-lazy-me/QChatGPT-Wiki", + link: "https://github.com/RockChinQ/LangBot", }, ], }, diff --git a/docs/assets/image/deploy/bots/arch.png b/docs/assets/image/deploy/bots/arch.png new file mode 100644 index 000000000..cc4c6fa23 Binary files /dev/null and b/docs/assets/image/deploy/bots/arch.png differ diff --git a/docs/assets/image/deploy/models/arch.png b/docs/assets/image/deploy/models/arch.png new file mode 100644 index 000000000..4bf272b27 Binary files /dev/null and b/docs/assets/image/deploy/models/arch.png differ diff --git a/docs/assets/image/deploy/pipelines/arch.png b/docs/assets/image/deploy/pipelines/arch.png new file mode 100644 index 000000000..c3a099382 Binary files /dev/null and b/docs/assets/image/deploy/pipelines/arch.png differ diff --git a/docs/zh/config/function/command.md b/docs/zh/config/function/command.md deleted file mode 100644 index a08b2af3c..000000000 --- a/docs/zh/config/function/command.md +++ /dev/null @@ -1,42 +0,0 @@ -# command.json 配置项 - -:::info 目录 -[[toc]] -::: - -`data/config/command.json` 中配置命令相关的配置项。 - -## 命令权限 privilege - -设置每个命令的权限配置 - -普通用户权限级别为 1,管理员(`system.json`中设置的)权限级别为 2。 - -在这里设置每个命令的最低权限级别,若设置为1,则用户和管理员均可用,若为2,则仅管理员可用 - - 需要设置子命令,以点号间隔,如`"plugin.on"` 示例: - -```json -{ - "plugin": 1, - "plugin.on": 2 -} -``` - - 意思是 plugin 命令的最低权限级别为 1,plugin.on 命令的最低权限级别为 2。 每个命令都有默认的权限级别 - -若不设置,则使用默认的级别。在`pkg/command/operators`里每个命令类有默认的权限级别 - -## 命令前缀 command-prefix - -设置命令前缀。以数组形式设置,程序将前缀符合设置的消息视为命令(群内需要符合群响应规则)。 - -如下示例将设置命令前缀为`!`、`!`、`#`: - -```json -"command-prefix": [ - "!", - "!", - "#" -] -``` \ No newline at end of file diff --git a/docs/zh/config/function/pipeline.md b/docs/zh/config/function/pipeline.md deleted file mode 100644 index a97900e46..000000000 --- a/docs/zh/config/function/pipeline.md +++ /dev/null @@ -1,205 +0,0 @@ -# pipeline.json 配置项 - -:::info 目录 -[[toc]] -::: - -`data/config/pipeline.json` 配置程序处理一个请求的过程中的操作流程,平台适配器获取到消息事件之后,发送给pipeline排队进行处理。可以设置黑白名单、群响应规则、是否检查传入消息、传入消息忽略规则、是否检查敏感词、百度云内容审核配置、传入消息长度设置、限速配置等功能。 - - -## 访问控制 access-control - -```json -"access-control":{ - "mode": "blacklist", - "blacklist": [], - "whitelist": [] -}, -``` - -`mode`:设置模式白名单 `whitelist`(仅处理`whitelist`列表中的会话的消息)或黑名单 `blacklist`(忽略`blacklist`列表中的会话的消息) - -`blacklist`:格式`{type}_{id}`,示例:`"blacklist": ["group_12345678","person_12341234"],` - -`whitelist`:格式`{type}_{id}`,示例:`"whitelist": ["group_12345678","person_12341234"]` - - -## 群消息响应规则 respond-rules - -仅处理`access-control`通过的会话的消息,其中可含有多个key,若要对特定群设置响应规则,则以群号作为键。未特指的群,将使用 default 中的响应规则 - -```json -"respond-rules": { - "default": { - "at": true, - "prefix": [ - "/ai", "!ai", "!ai", "ai" - ], - "regexp": [], - "random": 0.0 - } -}, -``` - -`at`:`true`或`false`,为true时,所有at机器人的消息都会被响应 - -`prefix`:设置响应前缀,带有指定前缀的消息即使没有at机器人也会被响应,发送给AI时会删除前缀。例如: - -```json -"prefix": ["/ai", "!ai", "!ai", "ai"] - -此时,消息"ai 你好"就会被响应,发送给AI时会删除前缀"ai",即"你好" -``` - -`regexp`:正则匹配,[正则表达式教程](https://www.runoob.com/regexp/regexp-syntax.html) - -`random`:随机匹配概率,数值范围是0.0-1.0,对应概率0%-100%,为1.0时所有消息都响应 - -你可以为单个群聊设置特定的响应规则,例如 - -```json -"respond-rules": { - "default": { - "at": true, - "prefix": [ - "/ai", "!ai", "!ai", "ai" - ], - "regexp": [], - "random": 0.0 - }, - "123456":{ - "at": true, - "prefix": [ - "/ai", "!ai", "!ai", "ai" - ], - "regexp": [], - "random": 0.0 - }, - "789012":{ - "at": true, - "prefix": [ - "/ai", "!ai", "!ai", "ai" - ], - "regexp": [], - "random": 0.0 - } -}, -``` - -## 检查传入消息内容开关 income-msg-check - -```json -"income-msg-check": true, -``` - -`income-msg-check`:是否检查传入的消息 - -## 传入消息忽略规则 ignore-rules - -```json -"ignore-rules": { - "prefix": ["/"], - "regexp": [] -}, -``` - -符合规则的传入消息将被忽略,仅`income-msg-check`为`true`时生效 - -`prefix`:前缀为`/`的忽略 - -`regexp`:正则匹配的忽略 - -## 本地敏感词检查 check-sensitive-words - -```json -"check-sensitive-words": true, -``` - -`check-sensitive-words`:是否检查敏感词,敏感词词库为`data/config/sensitive-words.json`里面的 - -## 百度云内容审核配置 baidu-cloud-examine - -```json -"baidu-cloud-examine": { - "enable": false, - "api-key": "", - "api-secret": "" -}, -``` - -`baidu-cloud-examine`:控制是否使用是否进行百度云内容审核 - -`enable`:enable=true时启用,一定会检查AI响应结果,仅`income-msg-check`为true时检查传入消息 - -`api-key`:百度AI开放平台的`API_KEY` - -`api-secret`:百度AI开放平台的`SECRET_KEY` - -*`API_KEY`与`SECRET_KEY`是在创建完毕应用后,系统分配给用户的,均为字符串,用于标识用户,为访问做签名验证,可在AI服务控制台中的**应用列表**中查看* - -## 请求限速规则 rate-limit - -```json -"rate-limit": { - "strategy": "drop", - "algo": "fixwin", - "fixwin": { - "default": { - "window-size": 60, - "limit": 60 - } - } -} -``` - -`strategy`:会话中的请求速率超过限制时的处理策略,`drop`为丢弃新请求,`wait`为等待请求速率降到限制以下 - -`algo`: 使用的算法,目前仅支持 `fixwin` (固定窗口),即窗口期内最多处理多少个请求,可自行实现其他限速算法,具体查看插件编写教程 - -`fixwin`:具体速率设置,设定的窗口期内最多处理多少个请求,支持对特定session指定限速,格式为 {type}_{id},示例:group_12345678,person_12341234 - -`window-size`:窗口期大小,单位秒 - -`limit`:窗口期内最多处理多少个请求 - -例如: - -```json -"fixwin": { - "default": { - "window-size": 60, - "limit": 60 - }, - "group_12345678": { - "window-size": 30, - "limit": 60 - }, - "person_12341234": { - "window-size": 60, - "limit": 60 - } -} -``` - -将设定: - -- 默认群窗口期60秒内最多处理60个请求 -- 群号为12345678的窗口期30秒内最多处理60个请求 -- 用户号为12341234的窗口期60秒内最多处理60个请求 - -## 对话历史记录截断 msg-truncate - -将在发送消息给模型之前对当前会话的历史消息进行截断,以限制传给模型的消息长度 - -```json -"msg-truncate": { - "method": "round", - "round": { - "max-round": 10 - } -} -``` - -`method`:截断方法,`round`为按回合截断,目前仅支持`round`,可自行实现其他截断方法,具体查看插件编写教程 - -`round`:按回合截断,`max-round`为最多保留多少回合的历史消息 \ No newline at end of file diff --git a/docs/zh/config/function/platform.md b/docs/zh/config/function/platform.md deleted file mode 100644 index 0bf058a42..000000000 --- a/docs/zh/config/function/platform.md +++ /dev/null @@ -1,145 +0,0 @@ -# platform.json 配置项 - -:::info 目录 -[[toc]] -::: - -`data/config/platform.json` 配置程序连接的消息平台和相关消息处理配置项。启用的消息适配器列表,是否跟踪内容函数调用过程,群内回复时是否引用原消息,群内回复时是否at原用户,强制消息延迟范围,长消息处理策略,是否向用户隐藏AI的异常信息等。 - -## 消息平台适配器 platform-adapters - -以下只列举部分适配器配置。 -```json -"platform-adapters": [ - { - "adapter": "nakuru", - "enable": false, - "host": "127.0.0.1", - "ws_port": 8080, - "http_port": 5700, - "token": "" - }, - { - "adapter": "aiocqhttp", - "enable": false, - "host": "0.0.0.0", - "port": 2280, - "access-token": "", - }, - { - "adapter": "qq-botpy", - "enable": false, - "appid": "", - "secret": "", - "intents": [ - "public_guild_messages", - "direct_message" - ] - }, - { - "adapter": "qqofficial", - "enable": false, - "appid": "", - "secret": "", - "port": 2284, - "token": "" - }, - { - "adapter": "wecom", - "enable": false, - "host": "0.0.0.0", - "port": 2290, - "corpid": "", - "secret": "", - "token": "", - "EncodingAESKey": "", - "contacts_secret": "" - }, -], -``` - -目前支持 `go-cqhttp`、`aiocqhttp`、`qq-botpy`、`qqofficial`、 `wecom` 等多种消息平台适配器,也可以同时启用多个同种类或不同种类的平台适配器。 -各个消息平台的配置方式请查看[部署文档](/deploy/quick-config/config.html#platform-json)。 - -### 多开示例 - -```json -"platform-adapters": [ - { - "adapter": "aiocqhttp", - "enable": false, - "host": "0.0.0.0", - "port": 2280, - "access-token": "", - }, - { - "adapter": "nakuru", - "enable": true, - "host": "127.0.0.1", - "ws_port": 8081, - "http_port": 5701, - "token": "token" - } -] -``` - -## 跟踪内容函数调用 track-function-calls - -```json -"track-function-calls": true, -``` - -是否跟踪内容函数调用过程,如果开启了,在对话中调用的内容函数记录也会发给用户 - -关闭后(false)仅会发给用户最终结果 - -> 内容函数功能请查看插件功能文档。 - - -## 引用原消息 quote-origin - -```json -"quote-origin": false, -``` - -在群内回复时是否引用原消息 - -## 是否at原用户 at-sender - -```json -"at-sender": false, -``` - -在群内回复时是否at原用户 - -## 强制消息延迟范围 force-delay - -```json -"force-delay": [0, 0], -``` - -在将响应内容发回给用户前的强制消息延迟时间范围,以防风控,单位是秒。 - -## 长消息处理策略 long-text-process - -```json -"long-text-process": { - "threshold": 256, - "strategy": "forward", - "font-path": "" -}, -``` - -`threshold`:阈值,文字长度大于此值的消息会使用长消息处理策略 - -`strategy`:长消息处理策略,目前支持forward(转发消息组件)和image(文字转图片) - -`font-path`: image的渲染字体。未设置时,如果在windows下,会尝试寻找系统的微软雅黑字体,若找不到,则转为forward策略。未设置时,若不是windows系统,则直接转为forward策略。 - -## 向用户隐藏AI接口的异常信息 hide-exception-info - -``` -"hide-exception-info": true -``` - - 是否向用户隐藏AI的异常信息,如果为true,当请求AI接口出现异常时,会返回一个错误的提示给用户。而把报错详情输出在控制台。 diff --git a/docs/zh/config/function/provider.md b/docs/zh/config/function/provider.md deleted file mode 100644 index b901ca5d0..000000000 --- a/docs/zh/config/function/provider.md +++ /dev/null @@ -1,382 +0,0 @@ -# provider.json 配置项 - -:::info 目录 -[[toc]] -::: - -`data/config/provider.json` 中配置AI接口提供商相关的配置项。 - -## 启用聊天功能 enable-chat - -```json -"enable-chat": true, -``` - -`enable-chat`:是否开启AI聊天功能 - -## 启用 AI 视觉功能 enable-vision - -```json -"enable-vision": true, -``` - -`enable-vision`:是否开启AI视觉功能。需要使用的模型同时支持视觉功能,详情见元数据板块。 - -## 模型接口密钥 keys - -::: info -不同模型的提供商可能使用不同的接口格式,LangBot 通过每个模型的三元组(请求器、密钥组、模型名称)来确定模型的使用方式。查看已支持的模型或添加自定义模型,请查看元数据配置板块 `llm-models.json` 文件。 -::: - -```json -"keys": { - "openai": [ - "sk-1234567890" - ], - "anthropic": [ - "sk-1234567890" - ], - "moonshot": [ - "sk-1234567890" - ], - "deepseek": [ - "sk-1234567890" - ], - "gitee-ai": [ - "XXXXX" - ], - "xai": [ - "xai-1234567890" - ], - "zhipuai": [ - "xxxxxxx" - ] - ... -}, -``` - -`keys`:设置密钥组,以字典的形式设置若干个密钥组,每个密钥组的键为密钥组名称,值为密钥列表。模型与密钥组的对应关系,请查看元数据板块 `llm-models.json` 文件。 - -目前支持的密钥组: - -- `openai`:[OpenAI](https://openai.com/) 的密钥组,如果你没有OpenAI API Key,你可以[在此中转站获取](https://api.qhaigc.net/) -- `anthropic`:[Anthropic](https://anthropic.com/) 的密钥组 -- `moonshot`:[Moonshot](https://moonshot.cn/)(月之暗面 kimi)的密钥组 -- `deepseek`:[Deepseek](https://deepseek.com/)(深度求索)的密钥组 -- `gitee-ai`: [Gitee AI](https://ai.gitee.com/) Serverless API 的密钥组 -- `siliconflow`: [SiliconFlow](https://siliconflow.cn/) 的密钥组 -- `bailian`: 阿里云百炼模型接口密钥组 -- `volcark`: 火山方舟模型、应用接口密钥组 -- `modelscope`: 魔搭社区接口密钥组 -- `ppio`:[PPIO](https://ppinfra.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) (派欧云)的密钥组 - -## 大模型请求器 requester - -```json -"requester": { - "openai-chat-completions": { - "base-url": "https://api.openai.com/v1", - "args": {}, - "timeout": 120 - }, - "anthropic-messages": { - "base-url": "https://api.anthropic.com", - "args": { - "max_tokens": 1024 - }, - "timeout": 120 - }, - "moonshot-chat-completions": { - "base-url": "https://api.moonshot.cn/v1", - "args": {}, - "timeout": 120 - }, - "deepseek-chat-completions": { - "base-url": "https://api.deepseek.com", - "args": {}, - "timeout": 120 - }, - "ollama-chat": { - "base-url": "http://127.0.0.1:11434", - "args": {}, - "timeout": 600 - }, - "gitee-ai-chat-completions": { - "base-url": "https://ai.gitee.com/v1", - "args": {}, - "timeout": 120 - }, - "xai-chat-completions": { - "base-url": "https://api.x.ai/v1", - "args": {}, - "timeout": 120 - }, - "zhipuai-chat-completions": { - "base-url": "https://open.bigmodel.cn/api/paas/v4", - "args": {}, - "timeout": 120 - } - ... - }, -``` - -`requester`:设置请求器,每个请求器的键为请求器名称,值为请求器配置。模型与请求器的对应关系,请查看元数据板块 `llm-models.json` 文件。实现请求器的方式,请查看插件编写教程。 - -目前支持的请求器有(除非编写插件实现了新的请求器,否则不支持在`requester`中添加新的请求器配置): - -- `openai-chat-completions`:[OpenAI](https://openai.com/) 的 ChatCompletion 请求器 -- `anthropic-messages`:[Anthropic](https://anthropic.com/) 请求器(Claude) -- `moonshot-chat-completions`:[Moonshot](https://moonshot.cn/) 请求器(月之暗面) -- `deepseek-chat-completions`:[Deepseek](https://deepseek.com/) 请求器(深度求索) -- `ollama-chat`:[Ollama](https://ollama.com/) 请求器,不需要密钥,直接请求目标地址的 Ollama 服务 -- `gitee-ai-chat-completions`:[Gitee AI](https://ai.gitee.com/) Serverless API 请求器(OpenAI 兼容接口) -- `xai-chat-completions`:[xAI](https://x.ai/) 请求器 -- `zhipuai-chat-completions`:[智谱 AI](https://open.bigmodel.cn/) 请求器 -- `lmstudio-chat-completions`:[LMStudio](https://lmstudio.ai/) 请求器 -- `siliconflow-chat-completions`:[SiliconFlow](https://siliconflow.cn/) 请求器 -- `bailian-chat-completions`:[阿里云百炼](https://bailian.console.aliyun.com/) 请求器,仅支持模型,应用请使用下方百炼平台运行器 -- `volcark-chat-completions`:[火山方舟](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) 请求器,默认为模型调用接口,应用(Bots)调用接口请在`base-url`后方添加`/bots` -- `modelscope-chat-completions`:[魔搭社区](https://modelscope.cn/) 请求器,使用魔搭社区的接口,需要确保账户以绑定阿里云账户 -- `ppio-chat-completions`:[PPIO](https://ppinfra.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) 请求器 - -`base-url`:设置接口地址。 - -`args`:请求时除了model之外的其他参数,以字典的形式设置,具体请查看各个接口提供商的文档。 - -`timeout`:设置请求超时时间,以秒为单位,对于耗时较长的模型,建议设置较大值。 - -## 使用的模型 model - -```json -"model": "gpt-3.5-turbo", -``` - -`model`:设置要使用的模型名称。此模型必须存在于 `llm-models.json` 元数据中。 - -具体支持的模型列表和各个模型对应的请求器和密钥组,请查看元数据板块 `llm-models.json` 文件。 - -## 情景预设(人格) prompt - -```json -"prompt-mode": "normal", -"prompt": { - "default": "如果用户之后想获取帮助,请你说”输入!help获取帮助“。" -} -``` - -`prompt-mode`:设置情景预设模式,值为`normal`(单预设模式)和`full-scenario`(完整历史对话模式) - -`normal`时,使用下面的`prompt`,可设置多个 - -```json -"prompt": { - "default": "如果用户之后想获取帮助,请你说”输入!help获取帮助“。", - "help": "如果用户之后想获取帮助,请你说”输入!help获取帮助“。" -} -``` - -`normal` 模式也支持读取`data/prompts`目录下的文件内容作为单个 System Prompt,文件名即为`prompt`的名称。 - -在使用中通过`!default set <预设名>`指令将其设为默认(将<预设名>整体替换) - -### full-scenario模式配置方法 - -把完整的历史对话以文件形式添加到`data/scenario/`目录下,参考`data/scenario/default.json` - -```json -{ - "prompt": [ - { - "role": "system", - "content": "You are a helpful assistant. 如果我需要帮助,你要说“输入!help获得帮助”" - }, - { - "role": "assistant", - "content": "好的,我是一个能干的AI助手。 如果你需要帮助,我会说“输入!help获得帮助”" - } - ] -} -``` - -`role` 为消息的角色,可以是`user`(用户)、`assistant`(AI)、`system`(系统) -`content` 为字符串,表示消息内容。 -在使用中通过`!default set <文件名>`指令将其设为默认(将<预设名>整体替换) - -## 请求运行器 runner - -```json -"runner": "local-agent", -``` - -设置聊天消息将由哪个运行器处理,默认是 `local-agent` -目前支持: - -- `local-agent`:LangBot 本地实现的一个 Agent 机制,实现会话管理、插件调用。 -- `dify-service-api`:使用 [Dify](https://dify.ai/) 的 Service API 机制,支持 聊天助手、Agent、工作流应用。 -- `dashscope-app-api`:使用 [阿里云百炼平台](https://bailian.console.aliyun.com/#/app-center) 自建应用的 API,支持 普通智能体应用、智能体编排应用。 - -::: info -仅在设置为`local-agent`时,才会使用 LangBot 内部配置的`模型`、`工具(内容函数)`、`提示词(情景预设)`、`本地存储的上下文`。 -::: - -## Dify Service API 配置 dify-service-api - -```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 - } - } -``` - -**仅在 `runner` 设置为 `dify-service-api` 时使用,需要配置以下内容:** - -- `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 官方的\...\格式;值为 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 秒。 - -![Dify 工作流应用的输出键](/assets/image/config_provider_01.png) - -### 请求变量 - -当使用工作流时,LangBot 会显式传入以下参数,您可以自行在 Dify 工作流的开始节点中添加: - -- `user_message_text`:用户消息的纯文本 -- `session_id`:用户会话id,私聊为 `person_`,群聊为 `group_` -- `conversation_id`:字符串,用户会话id,由 LangBot 生成。用户重置会话后,会重新生成 -- `msg_create_time`:数字类型,收到此消息的时间戳(秒) - -您可以[通过插件自定义任何变量](/plugin/dev/api-ref.html#%E8%AE%BE%E7%BD%AE%E8%AF%B7%E6%B1%82%E5%8F%98%E9%87%8F)。 - -![Dify 工作流开始节点配置](/assets/image/config_provider_02.png) - -使用 工作流 应用或 Agent 应用时,如果开启了`platform.json`中的`track-function-calls`,将会在 Dify 执行每个工具调用时,输出一个`调用函数xxx`的消息给用户。 -但如果是使用`chat`应用下的`ChatFlow`(聊天助手->工作流编排),无论如何只会输出 Answer(直接回复)节点返回的文本。 - - -## 阿里云百炼平台自建应用配置 dashscope-app-api - -```json - "dashscope-app-api": { - "app-type": "agent", - "api-key": "sk-1234567890", - "agent": { - "app-id": "Your_app_id", - "references_quote": "参考资料来自:" - }, - "workflow": { - "app-id": "Your_app_id", - "references_quote": "参考资料来自:", - "biz_params": { - "city": "北京", - "date": "2023-08-10" - } - } - } -``` - -**仅在 `runner` 设置为 `dashscope-app-api` 时使用,需要配置以下内容:** - -- `app-type`:使用的百炼平台应用类型。 `agent` - 智能体应用(右-紫色)、 `workflow` - 智能体编排应用(左-橙色) - -![dashscope application](/assets/image/dashscope_application.png) - -- `api-key`:阿里云百炼平台的 API 密钥 -- `agent`:智能体应用的配置 - - `app-id`: "上图中的应用ID", - - `references_quote`:引用来源的提示语,默认为`参考资料来自:` 如果你在智能体应用中添加了展示回答来源这个配置将会起作用 -- `workflow`:智能体编排应用的配置 - - `app-id`: "上图中的应用ID", - - `references_quote`:引用来源的提示语,默认为`参考资料来自:` 如果你在智能体应用中添加了展示回答来源这个配置将会起作用 - - `biz_params`:业务参数,用于传入到智能体编排应用中,city和date对应下方第二章图中的`变量名`,二者的值是要传入的可在其中调用的参数。 - - 与上述 Dify 相同,LangBot 也会传入`请求变量`到百炼应用。 - -`references_quote`解释图片 - -![dashscope application](/assets/image/dashScope_ref_quote.png) - -`biz_params`解释图片 - -![dashscope application](/assets/image/dashscope_bitz.png) - -## [MCP](https://modelcontextprotocol.io/) 配置 mcp - -MCP (Model Context Protocol) 是 Anthropic 设计的 Agent 上下文标准协议,现已被广泛采用。 -LangBot 支持通过 MCP 协议获取丰富工具,以供在 `local-agent` 中使用。 - -```json - "mcp": { - "servers": [ - { - "name": "weather", - "enable": true, - "mode": "sse", - "url": "http://localhost:8000/sse", - "headers": {}, - "timeout": 10 - }, - { - "name": "stock", - "enable": true, - "mode": "stdio", - "command": "python3", - "args": [ - "path/to/your/serverfile" - ], - "env": {} - } - ] - } -``` - -请先自行[阅读 MCP 的介绍](https://modelcontextprotocol.io/introduction),了解如何使用第三方 MCP Server。LangBot 目前仅支持 Stdio(Python) 和 SSE 两种通信方式。 - -- `SSE` 模式: - - `name` 服务器名称,自行定义 - - `enable` 是否启用本 Server - - `mode` 固定填写`SSE` - - `url` MCP SSE Server 的访问 URL - - `headers` 连接时的 headers,可选 - - `timeout` 连接超时时间 -- `stdio` 模式: - - `name` 服务器名称,自行定义 - - `enable` 是否启用本 Server - - `mode` 固定填写`stdio` - - `command` 执行命令 - - `args` 执行命令的参数 - - `env` 执行命令的环境变量,可选 - -::: info - -- 推荐使用 SSE 模式。 -- 使用 Stdio 时,仅支持执行 Python 脚本 Server。若 LangBot 运行在容器中,可以将 MCP Server 执行文件置于 `data` 目录下的新目录中,并使用 `command` 和 `args` 指定执行文件路径。 - -::: - - diff --git a/docs/zh/config/function/system.md b/docs/zh/config/function/system.md deleted file mode 100644 index 0183a042c..000000000 --- a/docs/zh/config/function/system.md +++ /dev/null @@ -1,133 +0,0 @@ -# system.json 配置项 - -:::info 目录 -[[toc]] -::: - - - -`data/config/system.json` 中配置系统设置,如管理员、网络代理、是否上报遥测数据供开发者分析、日志等级、会话消息处理并发数、流水线消息处理并发数、帮助消息等 - -## 管理员会话 admin-sessions - -```json -"admin-sessions": [], -``` - -`admin-sessions`:设置管理员会话,格式为 {type}_{id},type 为 "group" 或 "person",如: - -```json -"admin-sessions": ["group_123456789", "person_123456789"], -``` - -::: info -1. 如果你使用的是 QQ 官方的 API,session id 为映射之后的值,具体可以查看 [qq-botpy 元数据](https://docs.langbot.app/config/metadata/adapter-qq-botpy.html),或者查看程序处理消息时的控制台输出。 -2. 如果 session 指定了一个群,那么群内所有人的所有消息都会被认为是管理员消息。 -::: - -## 网络代理 network-proxies - -::: info -建议通过环境变量设置代理,配置文件的设置**会覆盖环境变量** -环境变量设置:`http_proxy` 和 `https_proxy` -::: - -```json -"network-proxies": { - "http": null, - "https": null -}, -``` - -`network-proxies`:设置网络代理,为正向代理,http和https都要填,例如 - -```json -"network-proxies": { - "http": "http://127.0.0.1:7890", - "https": "http://127.0.0.1:7890" -}, -``` - -## 上报遥测数据 report-usage - -```json -"report-usage": true, -``` - -`report-usage`:是否上报遥测数据供开发者分析,不包含敏感信息 - -## 日志等级 logging-level - -```json -"logging-level": "info", -``` - -`logging-level`:暂时没用,现在只能通过环境变量 DEBUG=true 来设置调试日志输出 - -## 会话消息处理并发数 session-concurrency - -```json -"session-concurrency": { - "default": 1 -}, -``` - -`session-concurrency`:会话消息处理并发数,粒度是每个会话,session格式为 {type}_{id},未指定的session使用 default 配置 - -## 流水线消息处理并发数 pipeline-concurrency - -```json -"pipeline-concurrency": 20, -``` - -`pipeline-concurrency`:流水线消息处理并发数,粒度是整个程序,目前使用 FCFS 算法调度各个请求。 - -## 遥测服务器url qcg-center-url - -LangBot 运行期间推送遥测数据的目标地址,默认为官方地址,若您自己部署了[qcg-center](https://github.com/RockChinQ/qcg-center),可以改为你的地址。 - -```json -"qcg-center-url": "https://api.qchatgpt.rockchin.top/api/v2" -``` - -## 帮助消息 help-message - -```json -"help-message": "LangBot - 😎高稳定性、🧩支持插件、🦄多模态的 ChatGPT QQ 机器人🤖\n链接:https://langbot.app" -``` - -`help-message`:帮助消息,用户发送 !help 命令时的输出 - -## HTTP 接口 http-api - -配置 HTTP 服务,需要启用才能访问 WebUI。 - -```json -"http-api": { - "enable": true, - "host": "0.0.0.0", - "port": 5300, - "jwt-expire": 604800 -}, -``` - -`enable`:是否启用 HTTP 接口 -`host`:HTTP 接口监听的地址 -`port`:HTTP 接口监听的端口 -`jwt-expire`:JWT 过期时间,单位为秒 - -## 持久化配置 persistence - -配置数据库信息。 - -```json -"persistence": { - "sqlite": { - "path": "data/persistence.db" - }, - "use": "sqlite" -} -``` - -`sqlite`:使用 SQLite 数据库,`path` 为数据库文件路径 -`use`:使用哪种数据库,目前仅支持 `sqlite` diff --git a/docs/zh/config/metadata/adapter-qq-botpy.md b/docs/zh/config/metadata/adapter-qq-botpy.md deleted file mode 100644 index 7ab8c596f..000000000 --- a/docs/zh/config/metadata/adapter-qq-botpy.md +++ /dev/null @@ -1,21 +0,0 @@ -# adapter-qq-botpy.json 元数据 - -`data/metadata/adapter-qq-botpy.json`,QQ 官方 API 适配器元数据。官方 API 在使用群聊接口时,群id和成员id为字符串,而 LangBot 内部只支持整型 id,为使重启后仍然是相同的对应关系,因此需要保存到一个文件中。 - -## 格式 - -```json -{ - "mapping": { - "groups": { - "15944D6D2B525C6E3536134D4669F067": 443241151434655 - }, - "members": { - "547A6244A731B4BEEBE5EE2AE4CD00A8": 232437565267568 - } - } -} -``` - -- `groups`: 群id映射关系,key为字符串群id,value为整型群id。 -- `members`: 成员id映射关系,key为字符串成员id,value为整型成员id。 \ No newline at end of file diff --git a/docs/zh/config/metadata/llm-models.md b/docs/zh/config/metadata/llm-models.md deleted file mode 100644 index c5e7addde..000000000 --- a/docs/zh/config/metadata/llm-models.md +++ /dev/null @@ -1,53 +0,0 @@ -# llm-models.json 元数据 - -`data/metadata/llm-models.json`,受支持的大语言模型列表,本文件中指定了可用于 `data/config/provider.json` 中的 `model` 列表,指定每个模型对应的 `Key 管理器` 和 `API 请求器`。 - -## 格式 - -```json -{ - "list": [ - { - "name": "default", - "requester": "openai-chat-completions", - "token_mgr": "openai", - "tool_call_supported": false, - "vision_supported": false - }, - { - "name": "gpt-3.5-turbo", - "tool_call_supported": true - }, - { - "name": "gpt-4o", - "tool_call_supported": true, - "vision_supported": true - } - ] -} -``` - -模型均列于`list`数组中,每个模型的字段如下: - -- `name`: 模型名称,用于在 `data/config/provider.json` 中的 `model` 列表中指定。 -- `model_name`: 进行请求时使用的模型名称,用于区分使用不同请求器的相同模型,若未设置则使用 `name` 字段。 -- `requester`: 请求器名称,指定使用哪个请求器请求该模型的响应,不同的请求器对应不同的接口格式。 - - 已支持的请求器,请到 `配置文件 provider.json` 中字段 `requester` 查看。 - - 需要自行编写插件以实现新的请求器,请查看插件开发文档中的`组件扩展`页。 -- `token_mgr`: Key 管理器,此模型使用的 key 组,对应 `data/config/provider.json` 中的 `keys` 列表。 -- `tool_call_supported`: 是否支持工具调用,标记此模型是否支持使用`内容函数`。 -- `vision_supported`: 是否支持图像输入,标记此模型是否支持使用`图像输入`。 - -`default` 模型是必须的,这是模型的默认配置,其他模型可以不设置所有的字段,只需设置 `name` 字段即可,其他字段会继承 `default` 模型的配置。 - -## 自动更新机制 - -LangBot 每次启动时,程序会自动从中央服务器获取最新的模型列表,本地 `llm-models.json` 中 `name` 与中央服务器返回的模型列表中的 `name` 进行对比,如果本地不存在,则添加,如果本地存在,则被远程获取的覆盖。 - -## 自定义模型 - -根据上述格式添加即可。 - -- 如果需要使用目前不支持的接口(请求器),需要自己扩展请求器,请参考插件开发文档 -> 组件扩展。 -- key 组可以自己在 `data/config/provider.json` 中的 `keys` 列表中添加。 -- 不建议修改默认的模型配置,因为启动时会被自动更新的信息覆盖。 \ No newline at end of file diff --git a/docs/zh/config/metadata/sensitive-words.md b/docs/zh/config/metadata/sensitive-words.md deleted file mode 100644 index 91cb4f1f4..000000000 --- a/docs/zh/config/metadata/sensitive-words.md +++ /dev/null @@ -1,3 +0,0 @@ -# sensitive-words.json 元数据 - -本地敏感词词库,参考 `data/metadata/sensitive-words.json` 内容进行修改即可。 \ No newline at end of file diff --git a/docs/zh/deploy/langbot/docker.md b/docs/zh/deploy/langbot/docker.md index 21e1aa4a5..861b847f4 100644 --- a/docs/zh/deploy/langbot/docker.md +++ b/docs/zh/deploy/langbot/docker.md @@ -1,11 +1,10 @@ # Docker部署 :::warning -请**确保**您具有以下能力: - - 了解 `Docker` 和 `Docker Compose` 的使用 - - 了解容器间网络通信配置方式 - - 了解容器文件挂载机制 - - 动手能力强、资料查找能力强 +建议您先学习以下内容: + + - `Docker` 和 `Docker Compose` 的使用 + - Docker 容器间网络通信配置方式 ::: :::info @@ -29,8 +28,9 @@ docker compose up 首次启动会输出创建配置文件的提示,请继续按照文件配置。 容器会映射`5300`端口供 WebUI 使用,您可以访问`http://127.0.0.1:5300`查看 WebUI。 -还会映射`2280-2290`端口供使用 OneBot 协议的消息平台适配器反向连接,请继续阅读[消息平台接入文档](/deploy/platforms/readme)。 +还会映射`2280-2290`端口供使用 OneBot 协议的消息平台适配器反向连接。 -## 注意 +完成 LangBot 部署后,请继续阅读: -- 安装的插件都会保存在`plugins`(映射到本目录`plugins`),安装插件时可能会自动安装相应的依赖,此时若`重新创建`容器,已安装的插件将被加载,但所需的增量依赖并未安装,会导致引入问题。您可以删除插件目录后重启,再次安装插件,以便程序可以自动安装插件所需依赖。 \ No newline at end of file +- [配置机器人文档](/zh/deploy/platforms/readme)。 +- [配置模型文档](/zh/deploy/models/readme)。 diff --git a/docs/zh/deploy/models/readme.md b/docs/zh/deploy/models/readme.md new file mode 100644 index 000000000..687872271 --- /dev/null +++ b/docs/zh/deploy/models/readme.md @@ -0,0 +1,5 @@ +# 配置模型 (Models) + +模型将被流水线用于处理消息,您配置的第一个模型将被设置为默认流水线的模型。 + +![arch](/assets/image/deploy/models/arch.png) \ No newline at end of file diff --git a/docs/zh/deploy/pipelines/readme.md b/docs/zh/deploy/pipelines/readme.md new file mode 100644 index 000000000..892326741 --- /dev/null +++ b/docs/zh/deploy/pipelines/readme.md @@ -0,0 +1,9 @@ +# 修改对话流水线配置 (Pipelines) + +流水线控制了收到消息之后的处理流程,以及与大模型之间的信息交互。每个机器人可以绑定到一条流水线上,同一条流水线能被多个机器人绑定。 + +LangBot 首次启动时会自动创建一个默认的流水线。创建机器人时,会自动绑定到默认流水线。创建第一个模型时,会自动将其设置为默认流水线的模型。 + +![arch](/assets/image/deploy/pipelines/arch.png) + +您可以创建多条流水线,用于不同的机器人,适应不同的场景。 \ No newline at end of file diff --git a/docs/zh/deploy/platforms/readme.md b/docs/zh/deploy/platforms/readme.md index 5dba87988..91ad984e8 100644 --- a/docs/zh/deploy/platforms/readme.md +++ b/docs/zh/deploy/platforms/readme.md @@ -1,6 +1,8 @@ -# 消息平台说明 +# 配置机器人 (Bots) -LangBot 需要连接消息平台 API 才能与用户交互,目前支持以下消息平台: +机器人用于从消息平台接收消息事件并调用流水线处理消息。 + +![arch](/assets/image/deploy/bots/arch.png) | 平台 | 状态 | 备注 |教程 | diff --git a/docs/zh/deploy/quick-config/config.md b/docs/zh/deploy/quick-config/config.md deleted file mode 100644 index 28c2de67a..000000000 --- a/docs/zh/deploy/quick-config/config.md +++ /dev/null @@ -1,331 +0,0 @@ -# 填写配置信息 - -修改以下配置文件即可启用 LangBot 的基本功能,当你阅读完此页面后,建议查看[配置详解](/config/function/platform.md),以了解更多的配置项详解 - -- `data/config/platform.json` -- `data/config/provider.json` -- `data/config/system.json` - -## platform.json - -修改此配置文件以指定需要连接的消息平台,只需要关注`platform-adapters`字段。 -目前支持 `go-cqhttp`(QQ逆向)、`aiocqhttp`(QQ逆向)、`qq-botpy`(QQ官方)、`wecom`(企业微信官方) 等多种消息平台适配器,也可以同时启用多个同种类或不同种类的平台适配器。 -请根据你部署的消息平台的情况选择填写。 - -::: info -如果消息平台和 LangBot 均运行在 Docker 中,请先配置下方适配器设置,具体网络配置可参考[Docker 网络配置详解](/deploy/network-details) -::: - -### aiocqhttp 适配器 - -用于接入 NapCat/Lagrange/LLOneBot 等兼容 OneBot 协议的机器人端(仅支持反向ws)。 - -```json -{ - "adapter": "aiocqhttp", - "enable": true, - "host": "0.0.0.0", - "port": 2280, - "access-token": "" -}, -``` - -`"adapter": "aiocqhttp"`,无需改动。 - -`enable`:是否启用,配置完成后请将其设为`true` - -`host`:监听的 IP 地址,一般就保持 0.0.0.0 就可以了。使用 aiocqhttp 时,LangBot 作为服务端被动等待框架连接,请在 NapCat/Lagrange/LLOneBot 等框架中设置`被动 ws 地址`或者`反向 ws 地址`(具体视框架而定)为 LangBot 监听的地址,且路径为`/ws`,例如:`ws://127.0.0.1:2280/ws`。 - -`port`:设置监听的端口,默认2280,需在 NapCat/Lagrange/LLOneBot 等框架中设置为与此处一致的端口。使用容器启动的 LangBot 默认暴露了 2280-2290 端口,请选用其中任意一个端口。 - -`access-token`:设置访问密钥,与 NapCat/Lagrange/LLOneBot 等框架中设置的保持一致 - -### qq-botpy 适配器(使用websocket方式) - -用于接入 QQ 官方机器人 API。 - -```json -{ - "adapter": "qq-botpy", - "enable": false, - "appid": "", - "secret": "", - "intents": [ - "public_guild_messages", - "direct_message", - "public_messages" - ] -} -``` - -`"adapter": "qq-botpy"`,无需改动。 - -`enable`:是否启用,配置完成后请将其设为`true` - -`appid`:申请到的QQ官方机器人的appid - -`secret`:申请到的QQ官方机器人的secret - -`intents`:控制监听的事件类型,需要填写才能接收到对应消息,目前支持的事件类型有: - -- `public_guild_messages` QQ 频道消息 -- `direct_message` QQ 频道私聊消息 -- `public_messages` Q群 和 列表私聊消息 - -### qqofficial 适配器(使用webhook方式) - -用于接入QQ官方机器人(webhook接入)。 - -```json -{ - "adapter": "qqofficial", - "enable": false, - "appid": "", - "secret": "", - "port": 2284, - "token": "" -}, -``` - -`"adapter": "qqofficial"`,无需改动。 - -`enable`:是否启用,配置完成后请将其设为`true` - -`appid`:申请到的QQ官方机器人的appid - -`secret`:申请到的QQ官方机器人的secret - -`token`: 申请到的QQ官方机器人的token - -`port`: 启动端口,一般不改动。 - -### Nakuru 适配器 - -用于接入 go-cqhttp。 - -```json -{ - "adapter": "nakuru", - "enable": false, - "host": "127.0.0.1", - "ws_port": 8080, - "http_port": 5700, - "token": "" -}, -``` - -`"adapter": "nakuru"`,无需改动。 - -`enable`:是否启用,配置完成后请将其设为`true` - -`host`:运行 go-cqhttp 的主机地址,一般不改动 - -`ws_port`:正向WS服务器监听地址,与`go-cqhttp`的`config.yml`里面的保持一致 - -`http_port`:http服务器监听地址,与`go-cqhttp`的`config.yml`里面的保持一致 - -`token`:验证密钥,,与`go-cqhttp`的`config.yml`里面的保持一致 - -### 企业微信适配器 - -用于接入企业微信机器人,如果不清楚这些内容应该填写什么,请查看[配置企业微信](/deploy/platforms/wecom/wecom.md)。 - -```json -{ - "adapter": "wecom", - "enable": false, - "host": "0.0.0.0", - "port": 2290, - "corpid": "", - "secret": "", - "token": "", - "EncodingAESKey": "", - "contacts_secret": "" -}, -``` -`"adapter": "wecom"`,无需改动。 - -`enable`:是否启用,配置完成后请将其设为`true` - -`host`:运行 企业微信回调地址 的主机地址,一般不改动 - -`port`:运行 企业微信回调地址 的监听端口,一般不改动 - -`corpid`,`secret`,`token`,`EncodingAESKey`,`contacts_secret`都在企业微信配置项页中获取。 - -### 微信公众号适配器 - -用于接入微信公众号机器人。 - -```json -{ - "adapter":"officialaccount", - "enable": true, - "token": "", - "EncodingAESKey":"", - "AppSecret":"", - "AppID":"", - "Mode":"drop", - "LoadingMessage":"AI正在思考中,请发送任意内容获取回复。", - "host": "0.0.0.0", - "port": 2287 -} -``` - -`"adapter": "officialaccount"`,无需改动。 - -`enable`:是否启用,配置完成后请将其设为`true` - -`Mode`:具体参照微信公众号部署页面 - -`LoadingMessage`: 加载信息,可更改为其他内容,仅在模式为 `passive` 下有效 - -`host`:运行 微信公众号回调地址 的主机地址,一般不改动 - -`port`:运行 微信公众号回调地址 的监听端口,一般不改动 - -`AppSecret`,`token`,`EncodingAESKey`,`AppID`都在微信公众号配置项页中获取。 - -## 个人微信 - -具体用法请查看[配置个人微信](/deploy/platforms/wechat/gewechat.md)。 - -```json -{ - "adapter": "gewechat", - "enable": true, - "gewechat_url": "http://gewe:2531", - "port": 2286, - "callback_url": "http://langbot:2286/gewechat/callback", - "app_id": "", - "token": "" -} -``` - -## 飞书 - -具体用法请查看[配置飞书](/deploy/platforms/lark.md)。 - -```json -{ - "adapter": "lark", - "enable": false, - "app_id": "cli_abcdefgh", - "app_secret": "XXXXXXXXXX", - "bot_name": "LangBot", - "enable-webhook": false, - "port": 2285, - "encrypt-key": "xxxxxxxxx" -}, -``` - -## 钉钉适配器 - -具体用法请查看[配置钉钉机器人](/deploy/platforms/dingtalk.md)。 - -```json -{ - "adapter":"dingtalk", - "enable": false, - "client_id":"", - "client_secret":"", - "robot_code":"", - "robot_name":"", - "markdown_card":false -}, -``` - -## Discord - -具体用法请查看[配置 Discord](/deploy/platforms/discord.md)。 - -```json -{ - "adapter": "discord", - "enable": false, - "client_id": "1234567890", - "token": "XXXXXXXXXX" -}, -``` - -### Slack - -具体用法请查看[配置Slack](/deploy/platforms/slack.md)。 - -```json -{ - "adapter":"slack", - "enable":false, - "bot_token":"", - "signing_secret":"", - "port":2288 -} -``` - -### 企业微信客服号 - -具体用法请查看[配置企业微信客服号](/deploy/platforms/wecom/wecomcs.md) - -```json -{ - "adapter": "wecomcs", - "enable": false, - "port": 2289, - "corpid": "", - "secret": "", - "token": "", - "EncodingAESKey": "" -} -``` - -## provider.json - -修改此配置文件以设置所连接的 AI 提供商的相关信息。 - -> 如果没有OpenAI API Key,你可以[在此获取](https://api.qhaigc.net/) - -以下仅讲解启用 OpenAI 接口的方式,具体设置方法请查看 [功能配置`provider.json` 页](/config/function/provider)。 - -编辑 `data/provider.json`,在`keys`->`openai`中添加你的 OpenAI API Key,例如: - -```json - "keys": { - "openai": [ - "sk-AAAAAAAAAAAABBBBBBBBBBBBCCCCCCCCCCCCCDDDDDDDDD" - ], - }, -``` - -如果你使用的是中转站,或者其他兼容 OpenAI 格式的平台,请将`requester`->`openai-chat-completions`->`base-url`设置为你的中转站地址。例如: - -地址后记得加`/v1`。 - -```json - "openai-chat-completions": { - "base-url": "https://api.example.com/v1", - "args": {}, - "timeout": 120 - }, -``` - -最后,将`model`改为你想要使用的模型,例如: - -```json - "model": "gpt-4o", -``` - -## system.json - -在 `data/system.json` 中修改 `admin-sessions`,添加 `person_你的QQ号` 把你与机器人的会话设置为管理员(仅 person 会话私聊有效),例如: - -```json - "admin-sessions": [ - "person_1010553892" - ], -``` - -::: tip - -阅读并完成以上教程后,请根据你部署 LangBot 的方式重启,你应该可以成功使用了,如果不能请再次阅读(你或许漏做或错做某些步骤),如果完全阅读并充分理解本文档后仍然确实无法使用,你可以在[这里](/insight/community.html)找到交流群。 - -::: diff --git a/docs/zh/webui/intro.md b/docs/zh/webui/intro.md deleted file mode 100644 index f34a1ef9b..000000000 --- a/docs/zh/webui/intro.md +++ /dev/null @@ -1,21 +0,0 @@ -# 管理面板(Beta测试) - -管理面板(WebUI)将在 v3.4.0 版本开始 Beta 测试,有任何问题或建议欢迎反馈到:https://github.com/RockChinQ/LangBot/issues - -![WebUI](/assets/image/webui_intro_01.png) - -## 部署 WebUI - -依据本文档所述的部署方式新部署的实例,均自带 WebUI,默认启用。 - -### 从低于 3.4.0 版本升级的实例? - -若是使用 Docker 拉取最新的镜像,也自带有 WebUI;若是手动部署的实例,请从 [Releases](https://github.com/RockChinQ/LangBot) 页面下载最新版的 `langbot-xxx-all.zip` 文件,解压覆盖之前部署的代码目录。 - -## 未实现功能 - -- Prompt 编辑器:单独一页,实现一个直观、便捷的 Prompt 编辑器。 -- 消息平台管理页:现在仅支持在 设置 页修改消息平台,后续将把消息平台的修改、重载、统计整合到单独一页。 -- 元数据文件编辑:目前暂不支持元数据编辑,请先根据文档修改文件内容来编辑。 -- 模型数据更改:动态编辑模型元数据、所使用的模型、各会话区分模型等功能将在元数据编辑支持后规划,目前请先根据文档手动编辑文件。 - diff --git a/docs/zh/webui/settings.md b/docs/zh/webui/settings.md deleted file mode 100644 index 41c9b9d4f..000000000 --- a/docs/zh/webui/settings.md +++ /dev/null @@ -1,31 +0,0 @@ -# 设置项管理 - -设置项编辑页的内容均对应[功能配置页](/config/function/platform.html)中各个配置文件的内容。目前支持`可视化编辑`和`JSON编辑`两种,JSON 编辑器与功能配置页中的配置文件内容一致,可直接编辑。 - -## 可视化编辑 - -### 基本字段 - -基本的字段直接编辑或者选择即可。 - -![开关](/assets/image/webui_settings_01.png) - -![文本框](/assets/image/webui_settings_02.png) - -### 字符串数组 - -输入要添加的字符串,按回车键即可添加。 - -![字符串数组](/assets/image/webui_settings_03.png) - -### 对象数组 - -例如消息平台适配器,数组内均为对象,可以点击下方`添加`按钮,添加新的适配器,选择类型后会展示对应需要填写的参数,按照文档所述填写。 - -![对象数组](/assets/image/webui_settings_04.png) - -![添加对象](/assets/image/webui_settings_05.png) - -::: tip -消息平台适配器更改之后需要手动进行[`热重载`](/webui/system.html#%E7%83%AD%E9%87%8D%E8%BD%BD)以生效 -::: \ No newline at end of file diff --git a/docs/zh/webui/system.md b/docs/zh/webui/system.md deleted file mode 100644 index 729e4f02a..000000000 --- a/docs/zh/webui/system.md +++ /dev/null @@ -1,17 +0,0 @@ -# 系统操作 - -## 任务列表 - -任务列表中跟踪了`插件更新`、`插件安装`、`插件删除`等耗时任务的进度。 -点击侧栏下方的任务列表按钮,在任务列表对话框,可以查看任务执行步骤、日志等信息。 - -![任务列表对话框](/assets/image/webui_system_02.png) - -![任务日志](/assets/image/webui_system_03.png) - -## 热重载 - -目前支持热重载 消息平台、插件和 LLM 管理器,点击侧栏下方的系统信息中的对应按钮即可。 -在修改了 `消息平台适配器配置`或`provider.json 内的配置` 之后需要手动热重载`消息平台`或`LLM 管理器`,插件更改则会自动热重载。 - -![热重载](/assets/image/webui_system_04.png) \ No newline at end of file diff --git a/docs/zh/deploy/network-details.md b/docs/zh/workshop/network-details.md similarity index 100% rename from docs/zh/deploy/network-details.md rename to docs/zh/workshop/network-details.md