diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index e256094f1..cb2aa5d3f 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -61,10 +61,6 @@ export default defineConfig({ text: "llonebot", link: "/deploy/platforms/qq/aiocqhttp/llonebot", }, - { - text: "shamrock", - link: "/deploy/platforms/qq/aiocqhttp/shamrock", - }, { text: "go-cqhttp", link: "/deploy/platforms/qq/gocq", @@ -86,8 +82,6 @@ export default defineConfig({ }, ], }, - { text: "企业微信", link: "/deploy/platforms/wecom/wecom" }, - { text:"微信公众号",link:"/deploy/platforms/wxoa.md"}, { text: "个人微信", collapsed: true, items: [ @@ -97,8 +91,12 @@ export default defineConfig({ }, ], }, + { text: "企业微信", link: "/deploy/platforms/wecom/wecom" }, + { 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: "填写配置信息", link: "/deploy/quick-config/config" }, diff --git a/docs/assets/image/config_provider_02.png b/docs/assets/image/config_provider_02.png index da0d52c9d..6100d6242 100644 Binary files a/docs/assets/image/config_provider_02.png and b/docs/assets/image/config_provider_02.png differ diff --git a/docs/assets/image/ding1.png b/docs/assets/image/ding1.png new file mode 100644 index 000000000..097212104 Binary files /dev/null and b/docs/assets/image/ding1.png differ diff --git a/docs/assets/image/ding2.png b/docs/assets/image/ding2.png new file mode 100644 index 000000000..ceb9c847a Binary files /dev/null and b/docs/assets/image/ding2.png differ diff --git a/docs/assets/image/ding3.png b/docs/assets/image/ding3.png new file mode 100644 index 000000000..b386d2be1 Binary files /dev/null and b/docs/assets/image/ding3.png differ diff --git a/docs/assets/image/ding4.png b/docs/assets/image/ding4.png new file mode 100644 index 000000000..7df37c190 Binary files /dev/null and b/docs/assets/image/ding4.png differ diff --git a/docs/assets/image/ding5.png b/docs/assets/image/ding5.png new file mode 100644 index 000000000..eedea8025 Binary files /dev/null and b/docs/assets/image/ding5.png differ diff --git a/docs/assets/image/plugin_dev_tutor_01.png b/docs/assets/image/plugin_dev_tutor_01.png new file mode 100644 index 000000000..865c5f4a7 Binary files /dev/null and b/docs/assets/image/plugin_dev_tutor_01.png differ diff --git a/docs/assets/image/telegram_01.png b/docs/assets/image/telegram_01.png new file mode 100644 index 000000000..f41d5f353 Binary files /dev/null and b/docs/assets/image/telegram_01.png differ diff --git a/docs/assets/image/telegram_02.png b/docs/assets/image/telegram_02.png new file mode 100644 index 000000000..796a0127c Binary files /dev/null and b/docs/assets/image/telegram_02.png differ diff --git a/docs/assets/image/telegram_03.png b/docs/assets/image/telegram_03.png new file mode 100644 index 000000000..04c9050cd Binary files /dev/null and b/docs/assets/image/telegram_03.png differ diff --git a/docs/assets/image/telegram_04.png b/docs/assets/image/telegram_04.png new file mode 100644 index 000000000..fbde9d791 Binary files /dev/null and b/docs/assets/image/telegram_04.png differ diff --git a/docs/assets/image/telegram_05.png b/docs/assets/image/telegram_05.png new file mode 100644 index 000000000..ebaa1df40 Binary files /dev/null and b/docs/assets/image/telegram_05.png differ diff --git a/docs/config/function/provider.md b/docs/config/function/provider.md index 392736ed3..02a7a846e 100644 --- a/docs/config/function/provider.md +++ b/docs/config/function/provider.md @@ -64,6 +64,8 @@ - `deepseek`:[Deepseek](https://deepseek.com/)(深度求索)的密钥组 - `gitee-ai`: [Gitee AI](https://ai.gitee.com/) Serverless API 的密钥组 - `siliconflow`: [SiliconFlow](https://siliconflow.cn/) 的密钥组 +- `bailian`: 阿里云百炼模型接口密钥组 +- `volcark`: 火山方舟模型、应用接口密钥组 ## 大模型请求器 requester @@ -130,7 +132,8 @@ - `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` `base-url`:设置接口地址。 @@ -204,16 +207,23 @@ 设置聊天消息将由哪个运行器处理,默认是 `local-agent` 目前支持: -- `local-agent`:LangBot 本地实现的一个 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 @@ -233,8 +243,10 @@ **仅在 `runner` 设置为 `dify-service-api` 时使用,需要配置以下内容:** - `base-url`:Dify Service API 的地址,默认是 `https://api.dify.ai/v1`,这是 Dify 官方云服务的地址,如果你使用的是自部署的社区版,请设置为你的自部署地址。 -- `app-type`:使用的 Dify 应用类型。支持 `chat` - 聊天助手(含高级编排)、 `agent` - Agent、 `workflow` - 工作流;请填写下方对应的应用类型 API 参数 -- `chat`: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 应用的配置 @@ -247,11 +259,16 @@ ![Dify 工作流应用的输出键](/assets/image/config_provider_01.png) +### 请求变量 + 当使用工作流时,LangBot 会显式传入以下参数,您可以自行在 Dify 工作流的开始节点中添加: -- `langbot_user_message_text`:用户消息的纯文本 -- `langbot_session_id`:用户会话id,私聊为 `person_`,群聊为 `group_` -- `langbot_conversation_id`:用户会话id,由 LangBot 生成。用户重置会话后,会重新生成 +- `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) @@ -293,7 +310,8 @@ - `workflow`:智能体编排应用的配置 - `app-id`: "上图中的应用ID", - `references_quote`:引用来源的提示语,默认为`参考资料来自:` 如果你在智能体应用中添加了展示回答来源这个配置将会起作用 - - `biz_params`:业务参数,用于传入到智能体编排应用中,city和date对应下方第二章图中的`变量名`,二者的值是要传入的可在其中调用的参数 + - `biz_params`:业务参数,用于传入到智能体编排应用中,city和date对应下方第二章图中的`变量名`,二者的值是要传入的可在其中调用的参数。 + - 与上述 Dify 相同,LangBot 也会传入`请求变量`到百炼应用。 `references_quote`解释图片 @@ -301,4 +319,60 @@ `biz_params`解释图片 -![dashscope application](/assets/image/dashscope_bitz.png) \ No newline at end of file +![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/deploy/langbot/manual.md b/docs/deploy/langbot/manual.md index ac903a4cc..42396f07c 100644 --- a/docs/deploy/langbot/manual.md +++ b/docs/deploy/langbot/manual.md @@ -16,14 +16,27 @@ 您也可以使用以下命令克隆最新代码(有可能包含不稳定的代码)并使用: ```bash +# 克隆主仓库 git clone https://github.com/RockChinQ/LangBot cd LangBot +``` +若您位于中国大陆境内,可以从 [GitCode 镜像](https://gitcode.com/RockChinQ/LangBot) 克隆: + +```bash +git clone https://gitcode.com/RockChinQ/LangBot +cd LangBot +``` + +接下来手动构建前端: + +```bash # 构建前端,需要 NodeJS >= 22 cd web npm install && npm run build cd .. ``` + ::: 2. (建议)创建虚拟环境 @@ -47,7 +60,7 @@ pip install -r requirements.txt pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple ``` -3. 运行一次主程序,生成配置文件 +4. 运行一次主程序,生成配置文件 ```bash python main.py diff --git a/docs/deploy/platforms/dingtalk.md b/docs/deploy/platforms/dingtalk.md new file mode 100644 index 000000000..227630f0a --- /dev/null +++ b/docs/deploy/platforms/dingtalk.md @@ -0,0 +1,45 @@ +# 部署钉钉机器人 + +部署 LangBot 到钉钉。 + +## 创建机器人 + +进入 [钉钉开发者后台](https://open-dev.dingtalk.com/?spm=ding_open_doc.document.0.0.74f445e5MkawbT#/),登录并且进入组织。登录成功后进入开放平台,是这样的: +![钉钉开放平台](/assets/image/ding1.png) + +点击上方的 `应用开发`,然后点击右面蓝色的按钮 `创建应用`,填写机器人的基本信息,点击保存。 + +进入机器人的后台,比如我们有机器人 langbot2 ,那么它的管理页面是这样的: +![机器人页面](/assets/image/ding2.png) + +## 配置机器人 + + +点击 `添加应用能力`,`其他应用能力`,`机器人`中的 `配置`,点击配置并且填写信息之后,如下图: +![机器人配置](/assets/image/ding3.png) + +点击页面下方的`发布`,发布成功之后,点击机器人页面中左侧最下方的`版本管理与发布`,如图: +![版本管理与发布](/assets/image/ding4.png) + +如果是第一次创建机器人,那么右边是空的,需要点击`创建新版本`,在其中设置信息,然后设置`应用可见范围`,点击保存。 + +点击`事件订阅`,将其中的推送方式改为`Stream模式推送`。 + +## 填写配置信息 + +点击`凭证与基础信息`,记录`Client ID` 和 `Client Secret`, +点击`应用能力`,`机器人`,记录下 RobotCode 和 机器人名称。 +将以上配置项填写入[钉钉机器人配置项](/deploy/quick-config/config.md#钉钉适配器)。
+**启动 LangBot** 。 + +## 添加机器人 + +本文使用钉钉 windows 桌面版举例,点击上方的`搜索`,`功能`,然后输入刚才机器人创建的名称,如图: +![robot_png](/assets/image/ding5.png) + +点击机器人即可和机器人聊天。
+ +如果想要添加到群里,那么点击钉钉群的`群管理`,`机器人`,`添加机器人`,然后搜索机器人名称就可以在群中使用。 + + + diff --git a/docs/deploy/platforms/readme.md b/docs/deploy/platforms/readme.md index 6a6db54c0..0e1c96ffb 100644 --- a/docs/deploy/platforms/readme.md +++ b/docs/deploy/platforms/readme.md @@ -5,10 +5,12 @@ LangBot 需要连接消息平台 API 才能与用户交互,目前支持以下 | 平台 | 状态 | 备注 |教程 | | ------ | ---- | ---- | ---- | -| QQ 个人号 | ✅ | 使用普通的 QQ 号作为机器人,需要使用独立的协议端,支持 OneBot v11 和 go-cqhttp 协议 | [NapCat](/deploy/platforms/qq/aiocqhttp/napcat)
[Lagrange](/deploy/platforms/qq/aiocqhttp/lagrange)
[LiteLoaderQQNT](/deploy/platforms/qq/aiocqhttp/llonebot)
[Shamrock(不推荐)](/deploy/platforms/qq/aiocqhttp/shamrock)
[go-cqhttp(不推荐)](/deploy/platforms/qq/gocq) | +| QQ 个人号 | ✅ | 使用普通的 QQ 号作为机器人,需要使用独立的协议端,支持 OneBot v11 和 go-cqhttp 协议 | [NapCat](/deploy/platforms/qq/aiocqhttp/napcat)
[Lagrange](/deploy/platforms/qq/aiocqhttp/lagrange)
[LiteLoaderQQNT](/deploy/platforms/qq/aiocqhttp/llonebot)
[go-cqhttp(不推荐)](/deploy/platforms/qq/gocq) | | QQ 官方机器人 | ✅ | 接入 QQ 开放平台的机器人 API | [教程](/deploy/platforms/qq/official_webhook) | | 企业微信 | ✅ | 企业内部机器人 | [教程](/deploy/platforms/wecom/wecom) | | 微信公众号 | ✅ | 微信公众平台机器人 | [教程](/deploy/platforms/wxoa.md) | | 个人微信 | ✅ | 个人微信机器人 | [Gewechat](/deploy/platforms/wechat/gewechat) | | 飞书 | ✅ | | [教程](/deploy/platforms/lark) | -| Discord | ✅ | | [教程](/deploy/platforms/discord) | \ No newline at end of file +| 钉钉 | ✅ | | [教程](/deploy/platforms/dingtalk) | +| Discord | ✅ | | [教程](/deploy/platforms/discord) | +| Telegram | ✅ | | [教程](/deploy/platforms/telegram) | diff --git a/docs/deploy/platforms/telegram.md b/docs/deploy/platforms/telegram.md new file mode 100644 index 000000000..f12282cc6 --- /dev/null +++ b/docs/deploy/platforms/telegram.md @@ -0,0 +1,36 @@ +# 接入 Telegram 机器人 + +## 创建机器人 + +前往 [Telegram 机器人创建页面](https://t.me/botfather),按照提示操作,创建一个机器人。 + +![Telegram 机器人创建](/assets/image/telegram_01.png) + +![Telegram 机器人创建](/assets/image/telegram_02.png) + +创建完成后,BotFather 会返回一个 API Token,请妥善保存。接下来关闭`Privacy Mode`,以便在群聊中使用。 + +![Telegram 机器人 API Token](/assets/image/telegram_03.png) + +## 在 LangBot 中填写信息并启动 + +根据[填写配置信息](/deploy/quick-config/config)中的 Telegram 适配器配置,填写相关信息。 +将上一步获取的 API Token 填写到配置中。 + +```json + { + "adapter": "telegram", + "enable": true, + "token": "xxxxxxx" + }, +``` + +填写完成后启动 LangBot,若成功配置,日志中会出现`[02-02 16:48:15.263] manager.py (68) - [INFO] : 初始化平台适配器 1: telegram`的字样,保持 LangBot 运行。 + +## 使用机器人 + +现在在群里或者私聊机器人都可以正常使用了。 + +![Telegram 机器人使用](/assets/image/telegram_04.png) + +![Telegram 机器人使用](/assets/image/telegram_05.png) \ No newline at end of file diff --git a/docs/deploy/platforms/wechat/gewechat.md b/docs/deploy/platforms/wechat/gewechat.md index 306a2e628..d07ef8737 100644 --- a/docs/deploy/platforms/wechat/gewechat.md +++ b/docs/deploy/platforms/wechat/gewechat.md @@ -1,5 +1,9 @@ # 通过 Gewechat 接入个人微信 +:::warning +LangBot接入gewechat,仅供娱乐,请勿用于违法违规行为,否则后果自负。 +::: + **本教程要求 LangBot 以 Docker 容器部署**,请根据 LangBot 部署文档将 LangBot 部署到 Docker 中。 :::info @@ -53,6 +57,7 @@ docker run -itd --network langbot-network -v /root/temp:/root/temp -p 2531:2531 "adapter": "gewechat", "enable": true, "gewechat_url": "http://gewe:2531", + "gewechat_file_url": "http://gewe:2532", "port": 2286, "callback_url": "http://langbot:2286/gewechat/callback", "app_id": "", @@ -62,6 +67,7 @@ docker run -itd --network langbot-network -v /root/temp:/root/temp -p 2531:2531 - `enable` 是否启用个人微信适配器,请修改为 `true` - `gewechat_url` 上一步部署的 Gewechat 容器地址,端口默认为 2531,不需要填写路径 +- `gewechat_file_url` gewechat文件下载地址,端口默认为 2532,主机和 `gewechat_url` 相同,不需要填写路径 - `port` LangBot 监听 Gewechat 消息的端口,默认 2286,非必要勿修改 - `callback_url` 回调地址,是 Gewechat 容器推送消息给 LangBot 容器的地址,需要填写完整路径,例如 `http://langbot:2286/gewechat/callback`,端口与 `port` 一致,路径必须为 `/gewechat/callback` - `app_id` 和 `token` **请勿填写**,这是用于存储登录信息的,在首次启动扫码登录后会自动保存 diff --git a/docs/deploy/platforms/wecom/wecom.md b/docs/deploy/platforms/wecom/wecom.md index 1a90d8df6..f634c454e 100644 --- a/docs/deploy/platforms/wecom/wecom.md +++ b/docs/deploy/platforms/wecom/wecom.md @@ -2,6 +2,7 @@ 部署企业微信机器人接入 LangBot 。 + ## 创建机器人 进入[企业微信管理后台](https://work.weixin.qq.com/),登陆账号,进入主页面后,点击` 应用管理 `,` 自建 `,` 创建应用 `,填写机器人基本信息,创建好之后,会出现类似这样的界面: @@ -15,7 +16,13 @@ ![企业ID](/assets/image/wecom2.png) -2. 首先开启通讯录同步权限 +2. 开启通讯录同步权限 + +:::info +- 此配置项是为了实现 LangBot 的群发消息,具体代码位于libs/wecom_api/api.py 。 +- 目前 LangBot 仍在开发,所以未实现此配置项的相关功能。 +- 此配置项可以填写入随机字符,**不能为空**。 +::: ![通讯录权限](/assets/image/wecom5.png) @@ -23,9 +30,9 @@ ![通讯录同步secret](/assets/image/wecom3.jpg) -点击`查看secret`,记录下来,这是contacts_secret(通讯录同步 secret)。 +点击`查看secret`,记录下来,这是 contacts_secret(通讯录同步 secret)。 -3. 点击`应用管理`,找到刚才创建的机器人,查看机器人的 secret ,记录下来。 +3. 点击`应用管理`,找到刚才创建的机器人,查看机器人的 secret ,记录下来。 ![机器人secret](/assets/image/wecom4.png) diff --git a/docs/deploy/platforms/wxoa.md b/docs/deploy/platforms/wxoa.md index 1c37ae87d..611abe684 100644 --- a/docs/deploy/platforms/wxoa.md +++ b/docs/deploy/platforms/wxoa.md @@ -1,10 +1,20 @@ # 部署微信公众号机器人 部署微信公众号机器人接入 LangBot 。 -:::warning -- 目前微信公众号对于回复消息的时间有严格限制(不超过15s),所以LangBot在超出响应时间后会将报错打印在控制台上,而不是公众号回复给用户。 -- 如果您有更复杂的需求,请联系 LangBot 团队。 -::: + +## LangBot 微信公众号接入模式 + +目前,LangBot 提供两种方式接入微信公众号: + +1. **传统收发消息模式** + - 公众号要求请求必须在 **15 秒内** 处理完成,超时的 AI 生成内容将无法发送。 + - 当 AI 生成内容超时发生后,LangBot 会在控制台打印请求超时信息。 + +2. **“发送任意文字回复消息”模式** + - 该方法可突破 **15 秒** 限制,但 **过长的文本** 可能无法成功发送。 + - 使用此方法时,给公众号发消息,公众号会回复“AI正在思考中,请发送任意内容获取回答”,此时,需要发送任意内容获取回答。 + +如需更复杂的功能,请联系 **LangBot 团队** 进行定制化支持。 ## 创建机器人 @@ -30,7 +40,13 @@ ### 保存回调地址 点击设置服务器配置,输入`Token`,`EncodingAESKey`,并将消息加解密方式改为`安全模式`。
-至此,将获取到的四个配置项( AppID , AppSecret , token , EncodingAESKey )填入[微信公众号配置项](/deploy/quick-config/config.md#微信公众号适配器)。填写成功后,**启动 LangBot 。**
+至此,将获取到的四个配置项( AppID , AppSecret , token , EncodingAESKey )填入[微信公众号配置项](/deploy/quick-config/config.md#微信公众号适配器)。
+ +在配置项中,`Mode`选项为选择的接入模式,其中默认为`drop`,`drop` 为传统收发消息模式,`passive` 为发送任意文字获取回复模式。
+`LoadingMessage`选项为加载信息,可以更改为其他内容,仅在模式为`passive`下有效。 + +填写成功后,**启动 LangBot 。**
将 URL 填写为`https://your_domain_name/callback/command`,其中的 `your_domain_name` 就是 Caddy 中填写的域名。点击保存。如果可以保存成功,那么意味着部署成功。如果出现**系统发生错误,请稍后重试**,那么请重新检查以上配置内容是否填写正确。 + diff --git a/docs/deploy/quick-config/config.md b/docs/deploy/quick-config/config.md index b52a2c25a..1914e0895 100644 --- a/docs/deploy/quick-config/config.md +++ b/docs/deploy/quick-config/config.md @@ -9,7 +9,7 @@ ## platform.json 修改此配置文件以指定需要连接的消息平台,只需要关注`platform-adapters`字段。 -目前支持 `go-cqhttp`(QQ逆向)、`aiocqhttp`(QQ逆向)、`qq-botpy`(QQ官方)、`wecom`(企业微信官方) 消息平台适配器,也可以同时启用多个同种类或不同种类的平台适配器。 +目前支持 `go-cqhttp`(QQ逆向)、`aiocqhttp`(QQ逆向)、`qq-botpy`(QQ官方)、`wecom`(企业微信官方) 等多种消息平台适配器,也可以同时启用多个同种类或不同种类的平台适配器。 请根据你部署的消息平台的情况选择填写。 ::: info @@ -165,6 +165,8 @@ "EncodingAESKey":"", "AppSecret":"", "AppID":"", + "Mode":"drop", + "LoadingMessage":"AI正在思考中,请发送任意内容获取回复。", "host": "0.0.0.0", "port": 2287 } @@ -174,6 +176,10 @@ `enable`:是否启用,配置完成后请将其设为`true` +`Mode`:具体参照微信公众号部署页面 + +`LoadingMessage`: 加载信息,可更改为其他内容,仅在模式为 `passive` 下有效 + `host`:运行 微信公众号回调地址 的主机地址,一般不改动 `port`:运行 微信公众号回调地址 的监听端口,一般不改动 @@ -213,6 +219,21 @@ }, ``` +## 钉钉适配器 + +具体用法请查看[配置钉钉机器人](/deploy/platforms/dingtalk.md) + +```json +{ + "adapter":"dingtalk", + "enable": false, + "client_id":"", + "client_secret":"", + "robot_code":"", + "robot_name":"" +}, +``` + ## Discord 具体用法请查看[配置 Discord](/deploy/platforms/discord.md)。 diff --git a/docs/insight/community.md b/docs/insight/community.md index 3bf0ee8bc..ab32c6d7a 100644 --- a/docs/insight/community.md +++ b/docs/insight/community.md @@ -14,7 +14,8 @@ 解答各种问题 -- LangBot 社区(二):1030838208 ([链接](https://qm.qq.com/q/PF9OuQCCcM)) +- LangBot 社区(三):966235608 ([链接](https://qm.qq.com/q/JLi38whHum)) +- 【已满】LangBot 社区(二):1030838208 ([链接](https://qm.qq.com/q/PF9OuQCCcM)) - 【已满】LangBot 社区(一):619154800 ([链接](https://qm.qq.com/q/1K9GjQuza)) ### 🧩 插件开发群 diff --git a/docs/insight/intro.md b/docs/insight/intro.md index adc2a330a..6000b3918 100644 --- a/docs/insight/intro.md +++ b/docs/insight/intro.md @@ -85,19 +85,6 @@ - -## 限制 - -- ❗OpenAI 官方关于模型生成内容的警告: - - May occasionally generate incorrect information(可能会生成不正确的信息) - - May occasionally produce harmful instructions or biased content(可能会产生有害说明或有偏见的内容) - - Limited knowledge of world and events after 2021(对2021年后的世界和事件的了解有限) -- ❗模型无思维能力,仅针对传入的上下文根据数据集生成内容,请勿过于信任其输出 -- ❗模型不了解其运行平台及其使用的模型版本,任何针对其实现原理的问题答案均视为无效,请以项目文档为准 - -以上是关于此程序的限制的最高优先级描述,其他方式(如询问机器人相关信息)获得的描述均应被视为无效 -由于模型生成的内容导致的一切损失,本项目概不负责 - ## 使用方式 对话及绘图功能均直接调用OpenAI的模型进行处理,与机器人程序无关,这意味着模型并不了解此项目的相关信息(如实现方式、技术栈、运行平台等),除非在预设值中写入相关信息。 diff --git a/docs/plugin/dev/api-ref.md b/docs/plugin/dev/api-ref.md index cf0d042ed..1577a7588 100644 --- a/docs/plugin/dev/api-ref.md +++ b/docs/plugin/dev/api-ref.md @@ -56,6 +56,46 @@ ctx.add_return(name: str, value: Any) 添加返回值,事件返回值均为**可选**的,每个事件支持的返回值请查看`pkg.plugin.events`中的每个事件的注释。 +## 请求 API + +`请求(Query)`指的是用户向 LangBot 发送一个问题时,LangBot 处理该问题的程序上下文。此段落的 API 用于与这些上下文交互。 + +- 事件处理函数中,Query 对象一般位于`ctx.event.query` + +### 设置请求变量 + +```python +ctx.event.query.set_variable(key: str, value: typing.Any) +``` + +请求变量是与此次 Query 绑定的一个 `dict`,其中包含了一些程序上下文信息。如果使用的是 Dify 或者 阿里云百炼 等 LLMOps 的runner,[这些变量将被传入对应平台的 API 作为变量](/config/function/provider.html#%E8%AF%B7%E6%B1%82%E5%8F%98%E9%87%8F)。 +如果您需要使用插件设置变量,建议在`PromptPreProcessing`事件时处理。 + +- `key`:该变量的名称 +- `value`:该变量的值 + +### 获取请求变量 + +```python +ctx.event.query.get_variable(key: str) +``` + +获取请求变量。 + +- `key`:变量名称 +- 返回值:`typing.Any` + +### 获取所有请求变量 + +```python +ctx.event.query.get_variables() +``` + +获取此 Query 对象所有已设置的变量值。 + +- 返回值:`dict[str, typing.Any]` + + ## LangBot API 以下 API 是 LangBot 直接提供给插件调用的,可以在事件处理函数之外调用。 diff --git a/docs/plugin/dev/tutor.md b/docs/plugin/dev/tutor.md index a66856fe7..43deed12d 100644 --- a/docs/plugin/dev/tutor.md +++ b/docs/plugin/dev/tutor.md @@ -10,14 +10,14 @@ [[toc]] ::: -## 💬简介 +## 💬 简介 本页讲解普通插件开发步骤,插件内部有两种方法:事件监听器、内容函数。 事件监听器能在某些事件触发时进行响应,更改行为。内容函数可供大语言模型调用,具体请查看插件介绍页。 LangBot 还支持组件扩展,可以不局限于监听预定事件,做到整个组件替换,具体请阅读完此页后查看**组件扩展**页。 -## 💻快速开始 +## 💻 快速开始 按照文档部署此项目,并使其正常运行。 @@ -104,7 +104,7 @@ class HelloPlugin(BasePlugin): 编写完毕保存后,重新启动主程序,向机器人发送`!plugin`命令,若有`Hello`插件则说明插件加载成功 -## ❗规范(重要) +## ❗ 规范(重要) - 请每个插件独立一个目录以便管理,建议在Github上创建一个仓库储存单个插件,以便获取和更新 - 命名规范(重要): @@ -115,7 +115,7 @@ class HelloPlugin(BasePlugin): - 一个目录内可以存放多个Python程序文件,以独立出插件的各个功能,便于开发者管理,但不建议在一个目录内注册多个插件 - 插件需要的依赖库请在插件目录下的`requirements.txt`中指定,程序从储存库获取此插件时将自动安装依赖 -## 🪝内容函数 +## 🪝 内容函数 通过[GPT的Function Calling能力](https://platform.openai.com/docs/guides/gpt/function-calling)实现的`内容函数`,这是一种嵌入对话中,由GPT自动调用的函数。 @@ -201,7 +201,13 @@ async def access_web(self, query, url: str): - 这仅仅是一个示例,需要更高效的网络访问能力支持插件,请查看[WebwlkrPlugin](https://github.com/RockChinQ/WebwlkrPlugin) -## 📄名词解释 +## 📦 上架插件市场 + +当你的插件开发完成后,请上传到 GitHub,并在 [LangBot 仓库提出 issue](https://github.com/RockChinQ/LangBot/issues/new?assignees=&labels=%E7%8B%AC%E7%AB%8B%E6%8F%92%E4%BB%B6&projects=&template=submit-plugin.yml&title=%5BPlugin%5D%3A+%E8%AF%B7%E6%B1%82%E7%99%BB%E8%AE%B0%E6%96%B0%E6%8F%92%E4%BB%B6) ,待审核后将会添加到插件市场,约半个小时后会在 LangBot WebUI 插件页的插件市场上可见。 + +![](/assets/image/plugin_dev_tutor_01.png) + +## 📄 名词解释 ### 说明 diff --git a/docs/workshop/dify-service-api.md b/docs/workshop/dify-service-api.md index 44f7f224e..946ffeb55 100644 --- a/docs/workshop/dify-service-api.md +++ b/docs/workshop/dify-service-api.md @@ -1,9 +1,9 @@ # 在 LangBot 上使用 Dify [Dify](https://dify.ai) 是一款开源的大语言模型(LLM) 应用开发平台。它融合了后端即服务(Backend as Service)和 LLMOps 的理念,使开发者可以快速搭建生产级的生成式 AI 应用。 -Dify 可以创建聊天助手(含高级编排)、Agent、文本生成应用、工作流等应用。 +Dify 可以创建聊天助手(含Chatflow)、Agent、文本生成应用、工作流等应用。 -LangBot 目前支持`聊天助手`、`Agent`、`工作流`三种 Dify 应用类型。 +LangBot 目前支持`聊天助手`(含Chatflow)、`Agent`、`工作流`三种 Dify 应用类型。 ## 在 Dify 上创建应用