Merge branch 'langbot-app:main' into main
@@ -1,4 +1,5 @@
|
||||
node_modules/
|
||||
docs/.vitepress/cache/
|
||||
docs/.vitepress/dist
|
||||
.mintlify/
|
||||
.DS_Store
|
||||
/.omc
|
||||
.mintlify-last/
|
||||
|
Before Width: | Height: | Size: 217 KiB After Width: | Height: | Size: 217 KiB |
@@ -1,44 +1,48 @@
|
||||
# [LangBot](https://github.com/langbot-app/LangBot) 官方文档
|
||||
|
||||
> 此仓库是 LangBot 的文档仓库,代码仓库:
|
||||
> [LangBot 代码仓库](https://github.com/langbot-app/LangBot)
|
||||
> 这是 LangBot 4.0 的文档,3.0 文档请见 `v3` 分支
|
||||
|
||||
## 参与编写
|
||||
|
||||
文档基于 VitePress 生成,本地编写需要安装 Node 和 VitePress
|
||||
|
||||
Clone 本仓库,在目录下执行以下命令安装依赖:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
完成后即可修改文档,修改完后使用以下命令本地启动:
|
||||
|
||||
```bash
|
||||
npm run docs:dev
|
||||
```
|
||||
|
||||
### 使用图片
|
||||
|
||||
把图片放到 `docs/assets/image` 目录下,然后在文档中使用Web访问时的绝对路径引用,如:
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
### 部署细节
|
||||
|
||||
现在使用 Cloudflare Pages 托管,提交后 [@RockChinQ](https://github.com/RockChinQ) 更新分支进行自动部署。
|
||||
|
||||
### 一些规范化标准
|
||||
|
||||
- 文件夹和文件的命名:**一律使用全小写,单词直接`-`隔开,如**`plugin-intro.md`
|
||||
- 子文件(夹)的命名,**不加前缀**(即文件夹的名称),如:`deploy`文件夹下的,文件夹`langbot`,`langbot`文件夹下的`manual`文件称之为`manual.md`
|
||||
- 由于这是有关于文档的规范化命名,所以任何文件的名称都可以以教程的角度来理解,如`deploy`是有关部署的教程
|
||||
- 除了配置文件板块的文档,其他的页面都不要在顶部加目录
|
||||
|
||||
---
|
||||
|
||||
**[English README](README_EN.md)**
|
||||
# [LangBot](https://github.com/langbot-app/LangBot) 官方文档
|
||||
|
||||
> 此仓库是 LangBot 的文档仓库,代码仓库:
|
||||
> [LangBot 代码仓库](https://github.com/langbot-app/LangBot)
|
||||
> 这是 LangBot 4.0 的文档,3.0 文档请见 `v3` 分支
|
||||
|
||||
## 参与编写
|
||||
|
||||
文档基于 [Mintlify](https://mintlify.com/) 生成,本地编写需要安装 Node.js。
|
||||
|
||||
Clone 本仓库,在目录下执行以下命令安装依赖:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
完成后即可修改文档,修改完后使用以下命令本地启动预览:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
或者直接使用 `mintlify` CLI (推荐):
|
||||
```bash
|
||||
npx mintlify dev
|
||||
```
|
||||
|
||||
### 使用图片
|
||||
|
||||
把图片放到 `images` 目录下,然后在文档中使用绝对路径引用(相对于项目根目录),如:
|
||||
|
||||
```markdown
|
||||

|
||||
```
|
||||
|
||||
### 部署细节
|
||||
|
||||
现已迁移至 Mintlify 托管,提交至 `main` 分支后自动触发部署。
|
||||
|
||||
### 一些规范化标准
|
||||
|
||||
- 文件夹和文件的命名:**一律使用全小写,单词直接`-`隔开,如**`plugin-intro.mdx`
|
||||
- 子文件(夹)的命名,**不加前缀**(即文件夹的名称),如:`deploy`文件夹下的,文件夹`langbot`,`langbot`文件夹下的`manual`文件称之为`manual.mdx`
|
||||
- 文档文件格式统一使用 `.mdx` 以支持 Mintlify 组件。
|
||||
- 在 `docs.json` 中配置侧边栏导航结构。
|
||||
|
||||
---
|
||||
|
||||
**[English README](README_EN.md)**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
## Contributing to Documentation
|
||||
|
||||
The documentation is generated based on VitePress. Local development requires Node and VitePress installation.
|
||||
The documentation is generated based on [Mintlify](https://mintlify.com/). Local development requires Node.js installation.
|
||||
|
||||
Clone this repository and execute the following command in the directory to install dependencies:
|
||||
|
||||
@@ -17,28 +17,32 @@ npm install
|
||||
After completion, you can modify the documentation. After modifications, use the following command to start locally:
|
||||
|
||||
```bash
|
||||
npm run docs:dev
|
||||
npm run dev
|
||||
```
|
||||
Or use the `mintlify` CLI directly (recommended):
|
||||
```bash
|
||||
npx mintlify dev
|
||||
```
|
||||
|
||||
### Using Images
|
||||
|
||||
Place images in the `docs/assets/image` directory, then reference them using the absolute path when accessed via web, such as:
|
||||
Place images in the `images` directory, then reference them using the absolute path (relative to the project root), such as:
|
||||
|
||||
```markdown
|
||||

|
||||

|
||||
```
|
||||
|
||||
### Deployment Details
|
||||
|
||||
Currently hosted on Cloudflare Pages. After submission, [@RockChinQ](https://github.com/RockChinQ) updates the branch for automatic deployment.
|
||||
Now hosted on Mintlify. Commits to the `main` branch trigger automatic deployment.
|
||||
|
||||
### Some Standardization Guidelines
|
||||
|
||||
- Folder and file naming: **Use all lowercase, separate words with `-`, such as** `plugin-intro.md`
|
||||
- Sub-file (folder) naming: **No prefix** (i.e., the folder name), such as: in the `deploy` folder, the folder `langbot`, the `manual` file in the `langbot` folder is called `manual.md`
|
||||
- Since this is about standardized naming for documentation, any file name can be understood from a tutorial perspective, such as `deploy` being about deployment tutorials
|
||||
- Except for configuration file section documents, other pages should not have a table of contents at the top
|
||||
- Folder and file naming: **Use all lowercase, separate words with `-`, such as** `plugin-intro.mdx`
|
||||
- Sub-file (folder) naming: **No prefix** (i.e., the folder name), such as: in the `deploy` folder, the folder `langbot`, the `manual` file in the `langbot` folder is called `manual.mdx`
|
||||
- Documentation files should use `.mdx` format to support Mintlify components.
|
||||
- Configure sidebar navigation structure in `docs.json`.
|
||||
|
||||
---
|
||||
|
||||
**[中文版 README](README.md)**
|
||||
**[中文版 README](README.md)**
|
||||
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,628 @@
|
||||
{
|
||||
"$schema": "https://mintlify.com/docs.json",
|
||||
"theme": "mint",
|
||||
"name": "LangBot",
|
||||
"colors": {
|
||||
"primary": "#4692dd",
|
||||
"light": "#4692dd",
|
||||
"dark": "#4692dd"
|
||||
},
|
||||
"fontFamily": "Noto Sans SC",
|
||||
"logo": {
|
||||
"light": "/logo/langbot-logo-0.5x.png",
|
||||
"dark": "/logo/langbot-logo-0.5x.png",
|
||||
"href": "https://langbot.app"
|
||||
},
|
||||
"favicon": "/favicon.ico",
|
||||
"navbar": {
|
||||
"links": [
|
||||
{
|
||||
"label": "Home",
|
||||
"href": "https://langbot.app"
|
||||
},
|
||||
{
|
||||
"label": "Market",
|
||||
"href": "https://space.langbot.app"
|
||||
},
|
||||
{
|
||||
"label": "Blog",
|
||||
"href": "https://blog.langbot.app"
|
||||
},
|
||||
{
|
||||
"label": "Roadmap",
|
||||
"href": "https://langbot.featurebase.app/roadmap"
|
||||
}
|
||||
]
|
||||
},
|
||||
"footer": {
|
||||
"socials": {
|
||||
"github": "https://github.com/langbot-app/LangBot"
|
||||
}
|
||||
},
|
||||
"redirects": [
|
||||
{ "source": "/zh/deploy/models/readme", "destination": "/zh/usage/models/readme" },
|
||||
{ "source": "/zh/deploy/platforms/readme", "destination": "/zh/usage/platforms/readme" },
|
||||
{ "source": "/zh/deploy/pipelines/readme", "destination": "/zh/usage/pipelines/readme" },
|
||||
{ "source": "/zh/deploy/knowledge/readme", "destination": "/zh/usage/knowledge/readme" },
|
||||
{ "source": "/en/deploy/models/readme", "destination": "/en/usage/models/readme" },
|
||||
{ "source": "/en/deploy/platforms/readme", "destination": "/en/usage/platforms/readme" },
|
||||
{ "source": "/en/deploy/pipelines/readme", "destination": "/en/usage/pipelines/readme" },
|
||||
{ "source": "/en/deploy/knowledge/readme", "destination": "/en/usage/knowledge/readme" },
|
||||
{ "source": "/ja/deploy/models/readme", "destination": "/ja/usage/models/readme" },
|
||||
{ "source": "/ja/deploy/platforms/readme", "destination": "/ja/usage/platforms/readme" },
|
||||
{ "source": "/ja/deploy/pipelines/readme", "destination": "/ja/usage/pipelines/readme" },
|
||||
{ "source": "/ja/deploy/knowledge/readme", "destination": "/ja/usage/knowledge/readme" }
|
||||
],
|
||||
"navigation": {
|
||||
"languages": [
|
||||
{
|
||||
"language": "cn",
|
||||
"tabs": [
|
||||
{
|
||||
"tab": "指南",
|
||||
"groups": [
|
||||
{
|
||||
"group": "快速开始",
|
||||
"pages": [
|
||||
"zh/insight/guide",
|
||||
"zh/insight/features",
|
||||
"zh/insight/community"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "安装部署",
|
||||
"pages": [
|
||||
"zh/deploy/langbot/package",
|
||||
"zh/deploy/langbot/docker",
|
||||
"zh/deploy/langbot/one-click/1panel",
|
||||
"zh/deploy/langbot/one-click/bt",
|
||||
"zh/deploy/langbot/manual",
|
||||
"zh/deploy/settings",
|
||||
"zh/deploy/update",
|
||||
"zh/deploy/command"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "配置机器人",
|
||||
"pages": [
|
||||
"zh/usage/platforms/readme",
|
||||
"zh/usage/platforms/discord",
|
||||
"zh/usage/platforms/telegram",
|
||||
"zh/usage/platforms/slack",
|
||||
"zh/usage/platforms/line",
|
||||
"zh/usage/platforms/kook",
|
||||
"zh/usage/platforms/lark",
|
||||
"zh/usage/platforms/dingtalk",
|
||||
"zh/usage/platforms/wxoa",
|
||||
{
|
||||
"group": "QQ (OneBot v11)",
|
||||
"pages": [
|
||||
"zh/usage/platforms/qq/aiocqhttp/napcat",
|
||||
"zh/usage/platforms/qq/aiocqhttp/lagrange",
|
||||
"zh/usage/platforms/qq/aiocqhttp/llonebot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "QQ 官方机器人",
|
||||
"pages": [
|
||||
"zh/usage/platforms/qq/official_webhook",
|
||||
"zh/usage/platforms/qq/official"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "企业微信",
|
||||
"pages": [
|
||||
"zh/usage/platforms/wecom/wecom",
|
||||
"zh/usage/platforms/wecom/wecomcs",
|
||||
"zh/usage/platforms/wecom/wecombot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "微信",
|
||||
"pages": [
|
||||
"zh/usage/platforms/wechat/wechatpad"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "配置 AI 能力",
|
||||
"pages": [
|
||||
"zh/usage/models/readme",
|
||||
"zh/usage/pipelines/readme",
|
||||
{
|
||||
"group": "接入 LLMOps 平台",
|
||||
"pages": [
|
||||
"zh/usage/pipelines/dify",
|
||||
"zh/usage/pipelines/n8n",
|
||||
"zh/usage/pipelines/langflow",
|
||||
"zh/usage/pipelines/tbox",
|
||||
"zh/usage/pipelines/coze"
|
||||
]
|
||||
},
|
||||
"zh/usage/knowledge/readme",
|
||||
"zh/usage/mcp/readme"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "进阶运维",
|
||||
"pages": [
|
||||
"zh/workshop/production/proxy-and-ssl",
|
||||
"zh/workshop/network-details",
|
||||
"zh/workshop/mcp-details",
|
||||
"zh/insight/platform-features",
|
||||
{
|
||||
"group": "第三方模型接入",
|
||||
"pages": [
|
||||
"zh/workshop/newapi-integration",
|
||||
"zh/workshop/shengsuanyun-integration",
|
||||
"zh/workshop/tokenpony-integration",
|
||||
"zh/workshop/ppio-integration",
|
||||
"zh/workshop/302ai-integration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "规模使用",
|
||||
"hidden": true,
|
||||
"pages": [
|
||||
"zh/tob/index",
|
||||
"zh/tob/platform",
|
||||
"zh/tob/provider",
|
||||
"zh/tob/contact"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "插件使用",
|
||||
"pages": [
|
||||
"zh/plugin/plugin-intro",
|
||||
"zh/plugin/compatibility"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "开发者",
|
||||
"groups": [
|
||||
{
|
||||
"group": "插件开发",
|
||||
"pages": [
|
||||
"zh/plugin/dev/tutor",
|
||||
"zh/plugin/dev/basic-info",
|
||||
"zh/plugin/dev/directory-structure",
|
||||
{
|
||||
"group": "组件开发",
|
||||
"pages": [
|
||||
"zh/plugin/dev/components/add",
|
||||
"zh/plugin/dev/components/event-listener",
|
||||
"zh/plugin/dev/components/command",
|
||||
"zh/plugin/dev/components/tool",
|
||||
"zh/plugin/dev/components/knowledge-retriever"
|
||||
]
|
||||
},
|
||||
"zh/plugin/dev/style",
|
||||
"zh/plugin/dev/migration",
|
||||
{
|
||||
"group": "发布插件",
|
||||
"pages": [
|
||||
"zh/plugin/dev/publish/market",
|
||||
"zh/plugin/dev/publish/github"
|
||||
]
|
||||
},
|
||||
"zh/develop/plugin-runtime"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "插件 SDK API",
|
||||
"pages": [
|
||||
"zh/plugin/dev/apis/common",
|
||||
"zh/plugin/dev/apis/pipeline-events",
|
||||
"zh/plugin/dev/apis/messages",
|
||||
"zh/plugin/dev/apis/tech-details"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "核心开发",
|
||||
"pages": [
|
||||
"zh/develop/dev-config",
|
||||
"zh/develop/comp-arch",
|
||||
"zh/workshop/impl-platform-adapter",
|
||||
{
|
||||
"group": "Discord 适配器",
|
||||
"pages": [
|
||||
"zh/develop/adapter/discord/README",
|
||||
"zh/develop/adapter/discord/quick_start",
|
||||
"zh/develop/adapter/discord/design",
|
||||
"zh/develop/adapter/discord/api_reference",
|
||||
"zh/develop/adapter/discord/troubleshooting"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "API 参考",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Service API",
|
||||
"pages": [
|
||||
"zh/tags/readme",
|
||||
"zh/tags/webhook"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "HTTP API Reference",
|
||||
"openapi": {
|
||||
"source": "openapi/service-api-zh.json",
|
||||
"directory": "zh/api-reference"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"language": "en",
|
||||
"tabs": [
|
||||
{
|
||||
"tab": "Guides",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Quick Start",
|
||||
"pages": [
|
||||
"en/insight/guide",
|
||||
"en/insight/features",
|
||||
"en/insight/community"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Installation",
|
||||
"pages": [
|
||||
"en/deploy/langbot/package",
|
||||
"en/deploy/langbot/docker",
|
||||
"en/deploy/langbot/one-click/1panel",
|
||||
"en/deploy/langbot/one-click/bt",
|
||||
"en/deploy/langbot/manual",
|
||||
"en/deploy/settings",
|
||||
"en/deploy/update",
|
||||
"en/deploy/command"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Configure Bots",
|
||||
"pages": [
|
||||
"en/usage/platforms/readme",
|
||||
"en/usage/platforms/discord",
|
||||
"en/usage/platforms/telegram",
|
||||
"en/usage/platforms/slack",
|
||||
"en/usage/platforms/line",
|
||||
"en/usage/platforms/kook",
|
||||
"en/usage/platforms/lark",
|
||||
"en/usage/platforms/dingtalk",
|
||||
"en/usage/platforms/wxoa",
|
||||
{
|
||||
"group": "QQ (OneBot v11)",
|
||||
"pages": [
|
||||
"en/usage/platforms/qq/aiocqhttp/napcat",
|
||||
"en/usage/platforms/qq/aiocqhttp/lagrange",
|
||||
"en/usage/platforms/qq/aiocqhttp/llonebot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "QQ Official Bot",
|
||||
"pages": [
|
||||
"en/usage/platforms/qq/official_webhook"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "WeCom (Enterprise WeChat)",
|
||||
"pages": [
|
||||
"en/usage/platforms/wecom/wecom",
|
||||
"en/usage/platforms/wecom/wecomcs",
|
||||
"en/usage/platforms/wecom/wecombot"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "AI Configuration",
|
||||
"pages": [
|
||||
"en/usage/models/readme",
|
||||
"en/usage/pipelines/readme",
|
||||
{
|
||||
"group": "LLMOps Integrations",
|
||||
"pages": [
|
||||
"en/usage/pipelines/dify",
|
||||
"en/usage/pipelines/n8n",
|
||||
"en/usage/pipelines/langflow",
|
||||
"en/usage/pipelines/coze"
|
||||
]
|
||||
},
|
||||
"en/usage/knowledge/readme",
|
||||
"en/usage/mcp/readme"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Advanced Operations",
|
||||
"pages": [
|
||||
"en/workshop/production/proxy-and-ssl",
|
||||
"en/workshop/network-details",
|
||||
"en/workshop/mcp-details",
|
||||
"en/insight/platform-features",
|
||||
{
|
||||
"group": "Third-Party Model Providers",
|
||||
"pages": [
|
||||
"en/workshop/newapi-integration",
|
||||
"en/workshop/ppio-integration",
|
||||
"en/workshop/302ai-integration"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Using Plugins",
|
||||
"pages": [
|
||||
"en/plugin/plugin-intro",
|
||||
"en/plugin/compatibility"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Developers",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Plugin Development",
|
||||
"pages": [
|
||||
"en/plugin/dev/tutor",
|
||||
"en/plugin/dev/basic-info",
|
||||
"en/plugin/dev/directory-structure",
|
||||
{
|
||||
"group": "Component Development",
|
||||
"pages": [
|
||||
"en/plugin/dev/components/add",
|
||||
"en/plugin/dev/components/event-listener",
|
||||
"en/plugin/dev/components/command",
|
||||
"en/plugin/dev/components/tool",
|
||||
"en/plugin/dev/components/knowledge-retriever"
|
||||
]
|
||||
},
|
||||
"en/plugin/dev/style",
|
||||
"en/plugin/dev/migration",
|
||||
{
|
||||
"group": "Publish Plugin",
|
||||
"pages": [
|
||||
"en/plugin/dev/publish/market",
|
||||
"en/plugin/dev/publish/github"
|
||||
]
|
||||
},
|
||||
"en/develop/plugin-runtime"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Plugin SDK API",
|
||||
"pages": [
|
||||
"en/plugin/dev/apis/common",
|
||||
"en/plugin/dev/apis/pipeline-events",
|
||||
"en/plugin/dev/apis/messages",
|
||||
"en/plugin/dev/apis/tech-details"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Core Development",
|
||||
"pages": [
|
||||
"en/develop/dev-config",
|
||||
"en/develop/comp-arch",
|
||||
"en/workshop/impl-platform-adapter"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "API Reference",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Service API",
|
||||
"pages": [
|
||||
"en/tags/readme",
|
||||
"en/tags/webhook"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "HTTP API Reference",
|
||||
"openapi": {
|
||||
"source": "openapi/service-api-en.json",
|
||||
"directory": "en/api-reference"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"language": "jp",
|
||||
"tabs": [
|
||||
{
|
||||
"tab": "ガイド",
|
||||
"groups": [
|
||||
{
|
||||
"group": "クイックスタート",
|
||||
"pages": [
|
||||
"ja/insight/guide",
|
||||
"ja/insight/features",
|
||||
"ja/insight/community"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "インストール",
|
||||
"pages": [
|
||||
"ja/deploy/langbot/package",
|
||||
"ja/deploy/langbot/docker",
|
||||
"ja/deploy/langbot/one-click/1panel",
|
||||
"ja/deploy/langbot/one-click/bt",
|
||||
"ja/deploy/langbot/manual",
|
||||
"ja/deploy/settings",
|
||||
"ja/deploy/update",
|
||||
"ja/deploy/command"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "ボットを設定",
|
||||
"pages": [
|
||||
"ja/usage/platforms/readme",
|
||||
"ja/usage/platforms/discord",
|
||||
"ja/usage/platforms/telegram",
|
||||
"ja/usage/platforms/slack",
|
||||
"ja/usage/platforms/line",
|
||||
"ja/usage/platforms/kook",
|
||||
"ja/usage/platforms/lark",
|
||||
"ja/usage/platforms/dingtalk",
|
||||
"ja/usage/platforms/wxoa",
|
||||
{
|
||||
"group": "QQ (OneBot v11)",
|
||||
"pages": [
|
||||
"ja/usage/platforms/qq/aiocqhttp/napcat",
|
||||
"ja/usage/platforms/qq/aiocqhttp/lagrange",
|
||||
"ja/usage/platforms/qq/aiocqhttp/llonebot"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "QQ 公式ボット",
|
||||
"pages": [
|
||||
"ja/usage/platforms/qq/official_webhook"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "WeCom(企業微信)",
|
||||
"pages": [
|
||||
"ja/usage/platforms/wecom/wecom",
|
||||
"ja/usage/platforms/wecom/wecomcs",
|
||||
"ja/usage/platforms/wecom/wecombot"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "AI 設定",
|
||||
"pages": [
|
||||
"ja/usage/models/readme",
|
||||
"ja/usage/pipelines/readme",
|
||||
{
|
||||
"group": "LLMOps プラットフォーム連携",
|
||||
"pages": [
|
||||
"ja/usage/pipelines/dify",
|
||||
"ja/usage/pipelines/n8n",
|
||||
"ja/usage/pipelines/langflow",
|
||||
"ja/usage/pipelines/coze"
|
||||
]
|
||||
},
|
||||
"ja/usage/knowledge/readme",
|
||||
"ja/usage/mcp/readme"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "運用ガイド",
|
||||
"pages": [
|
||||
"ja/workshop/production/proxy-and-ssl",
|
||||
"ja/workshop/network-details",
|
||||
"ja/workshop/mcp-details",
|
||||
"ja/insight/platform-features",
|
||||
{
|
||||
"group": "サードパーティモデル接続",
|
||||
"pages": [
|
||||
"ja/workshop/newapi-integration",
|
||||
"ja/workshop/ppio-integration",
|
||||
"ja/workshop/302ai-integration"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "プラグインの利用",
|
||||
"pages": [
|
||||
"ja/plugin/plugin-intro",
|
||||
"ja/plugin/compatibility"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "開発者",
|
||||
"groups": [
|
||||
{
|
||||
"group": "プラグイン開発",
|
||||
"pages": [
|
||||
"ja/plugin/dev/tutor",
|
||||
"ja/plugin/dev/basic-info",
|
||||
"ja/plugin/dev/directory-structure",
|
||||
{
|
||||
"group": "コンポーネント開発",
|
||||
"pages": [
|
||||
"ja/plugin/dev/components/add",
|
||||
"ja/plugin/dev/components/event-listener",
|
||||
"ja/plugin/dev/components/command",
|
||||
"ja/plugin/dev/components/tool",
|
||||
"ja/plugin/dev/components/knowledge-retriever"
|
||||
]
|
||||
},
|
||||
"ja/plugin/dev/style",
|
||||
"ja/plugin/dev/migration",
|
||||
{
|
||||
"group": "プラグインを配布",
|
||||
"pages": [
|
||||
"ja/plugin/dev/publish/market",
|
||||
"ja/plugin/dev/publish/github"
|
||||
]
|
||||
},
|
||||
"ja/develop/plugin-runtime"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "プラグイン SDK API",
|
||||
"pages": [
|
||||
"ja/plugin/dev/apis/common",
|
||||
"ja/plugin/dev/apis/pipeline-events",
|
||||
"ja/plugin/dev/apis/messages",
|
||||
"ja/plugin/dev/apis/tech-details"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "コア開発",
|
||||
"pages": [
|
||||
"ja/develop/dev-config",
|
||||
"ja/develop/comp-arch",
|
||||
"ja/workshop/impl-platform-adapter"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "API リファレンス",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Service API",
|
||||
"pages": [
|
||||
"ja/tags/readme",
|
||||
"ja/tags/webhook"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "HTTP API Reference",
|
||||
"openapi": {
|
||||
"source": "openapi/service-api-ja.json",
|
||||
"directory": "ja/api-reference"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"description": "Production-grade AI Bot Platform for Discord, Telegram, LINE & WeChat etc.",
|
||||
"fonts": {
|
||||
"family": "Source Sans Pro"
|
||||
}
|
||||
}
|
||||
@@ -1,574 +0,0 @@
|
||||
import { defineConfig } from "vitepress";
|
||||
import { useSidebar } from "vitepress-openapi";
|
||||
import specZh from '../assets/service-api-openapi-zh.json' with { type: 'json' }
|
||||
import specEn from '../assets/service-api-openapi-en.json' with { type: 'json' }
|
||||
|
||||
const sidebarZh = useSidebar({
|
||||
spec: specZh,
|
||||
linkPrefix: '/zh/tags/',
|
||||
})
|
||||
|
||||
const sidebarEn = useSidebar({
|
||||
spec: specEn,
|
||||
linkPrefix: '/en/tags/',
|
||||
})
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
themeConfig: {
|
||||
logo: "/langbot-logo-0.5x.png",
|
||||
|
||||
// 编辑链接
|
||||
editLink: {
|
||||
pattern:
|
||||
"https://github.com/langbot-app/Langbot-Wiki/edit/main/docs/:path",
|
||||
},
|
||||
|
||||
// 本地搜索
|
||||
search: {
|
||||
provider: "local",
|
||||
},
|
||||
},
|
||||
|
||||
locales: {
|
||||
root: {
|
||||
title: "LangBot 文档",
|
||||
label: "简体中文",
|
||||
lang: "zh",
|
||||
link: "/zh/",
|
||||
themeConfig: {
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
nav: [
|
||||
{ text: "主页", link: "https://langbot.app" },
|
||||
{ text: "路线图", link: "https://langbot.featurebase.app/roadmap" },
|
||||
],
|
||||
|
||||
sidebar: [
|
||||
{
|
||||
text: "概述",
|
||||
items: [
|
||||
{ text: "新手指引(必看)", link: "/zh/insight/guide" },
|
||||
{ text: "社区资源", link: "/zh/insight/community" },
|
||||
{ text: "特性规格", link: "/zh/insight/features" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "部署和使用",
|
||||
items: [
|
||||
{
|
||||
text: "部署 LangBot",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "包管理器部署", link: "/zh/deploy/langbot/package" },
|
||||
{ text: "Docker部署", link: "/zh/deploy/langbot/docker" },
|
||||
{
|
||||
text: "1Panel面板部署",
|
||||
link: "/zh/deploy/langbot/one-click/1panel",
|
||||
},
|
||||
{
|
||||
text: "宝塔面板部署",
|
||||
link: "/zh/deploy/langbot/one-click/bt",
|
||||
},
|
||||
{ text: "手动部署", link: "/zh/deploy/langbot/manual" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "配置机器人",
|
||||
collapsed: true,
|
||||
link: "/zh/deploy/platforms/readme",
|
||||
items: [
|
||||
{
|
||||
text: "OneBot v11",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "NapCat",
|
||||
link: "/zh/deploy/platforms/qq/aiocqhttp/napcat",
|
||||
},
|
||||
{
|
||||
text: "Lagrange",
|
||||
link: "/zh/deploy/platforms/qq/aiocqhttp/lagrange",
|
||||
},
|
||||
{
|
||||
text: "llonebot",
|
||||
link: "/zh/deploy/platforms/qq/aiocqhttp/llonebot",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
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: "企业微信",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "内部应用",
|
||||
link: "/zh/deploy/platforms/wecom/wecom",
|
||||
},
|
||||
{
|
||||
text: "对外客服",
|
||||
link: "/zh/deploy/platforms/wecom/wecomcs",
|
||||
},
|
||||
{
|
||||
text: "智能机器人",
|
||||
link: "/zh/deploy/platforms/wecom/wecombot",
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "微信",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "WeChatPadPro",
|
||||
link: "/zh/deploy/platforms/wechat/wechatpad.md"
|
||||
},
|
||||
],
|
||||
},
|
||||
{ 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: "LINE", link: "/zh/deploy/platforms/line" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "配置模型",
|
||||
link: "/zh/deploy/models/readme",
|
||||
},
|
||||
{
|
||||
text: "修改对话流水线",
|
||||
link: "/zh/deploy/pipelines/readme",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Dify", link: "/zh/deploy/pipelines/dify" },
|
||||
{ text: "n8n", link: "/zh/deploy/pipelines/n8n" },
|
||||
{ text: "Langflow", link: "/zh/deploy/pipelines/langflow" },
|
||||
{ text: "TBox", link: "/zh/deploy/pipelines/tbox" },
|
||||
{ text: "Coze", link: "/zh/deploy/pipelines/coze" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "使用知识库",
|
||||
link: "/zh/deploy/knowledge/readme",
|
||||
},
|
||||
{
|
||||
text: "使用 MCP 服务",
|
||||
link: "zh/deploy/mcp/readme"
|
||||
},
|
||||
{
|
||||
text: "系统环境设置",
|
||||
link: "/zh/deploy/settings",
|
||||
},
|
||||
{
|
||||
text: "对话命令",
|
||||
link: "/zh/deploy/command",
|
||||
},
|
||||
{
|
||||
text: "更新 LangBot",
|
||||
link: "/zh/deploy/update",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "插件",
|
||||
// collapsed: true,
|
||||
items: [
|
||||
{ text: "插件介绍", link: "/zh/plugin/plugin-intro" },
|
||||
{
|
||||
text: "插件开发",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "基础教程", link: "/zh/plugin/dev/tutor" },
|
||||
{ text: "完善配置信息", link: "/zh/plugin/dev/basic-info" },
|
||||
{ text: "目录规范", link: "/zh/plugin/dev/directory-structure" },
|
||||
{
|
||||
text: "组件开发",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "添加组件", link: "/zh/plugin/dev/components/add" },
|
||||
{ text: "组件:事件监听器", link: "/zh/plugin/dev/components/event-listener" },
|
||||
{ text: "组件:命令", link: "/zh/plugin/dev/components/command" },
|
||||
{ text: "组件:工具", link: "/zh/plugin/dev/components/tool" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "API 参考",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "插件通用 API", link: "/zh/plugin/dev/apis/common" },
|
||||
{ text: "流水线事件", link: "/zh/plugin/dev/apis/pipeline-events" },
|
||||
{ text: "消息平台实体", link: "/zh/plugin/dev/apis/messages" },
|
||||
],
|
||||
},
|
||||
{ text: "迁移指南", link: "/zh/plugin/dev/migration" },
|
||||
{
|
||||
text: "分发插件", collapsed: true,
|
||||
items: [
|
||||
{ text: "发布到插件市场", link: "/zh/plugin/dev/publish/market" },
|
||||
{ text: "通过 GitHub 分发", link: "/zh/plugin/dev/publish/github" },
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "系统兼容处理", link: "/zh/plugin/compatibility" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "实践",
|
||||
items: [
|
||||
{
|
||||
text: "如何实现一个消息平台适配器?",
|
||||
link: "/zh/workshop/impl-platform-adapter",
|
||||
},
|
||||
{
|
||||
text: "容器网络配置详解",
|
||||
link: "/zh/workshop/network-details",
|
||||
},
|
||||
{
|
||||
text: "使用 New API 中转多种渠道模型",
|
||||
link: "/zh/workshop/newapi-integration"
|
||||
},
|
||||
{
|
||||
text: "接入来自胜算云的模型",
|
||||
link: "/zh/workshop/shengsuanyun-integration"
|
||||
},
|
||||
{
|
||||
text: "接入来自小马算力的模型",
|
||||
link: "/zh/workshop/tokenpony-integration"
|
||||
},
|
||||
{
|
||||
text: "接入 PPIO API 的模型",
|
||||
link: "/zh/workshop/ppio-integration"
|
||||
},
|
||||
{
|
||||
text: "接入 302.AI 的模型",
|
||||
link: "/zh/workshop/302ai-integration"
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "[Beta] Service API 参考",
|
||||
items: [
|
||||
{ text: "概述", link: "/zh/tags/readme" },
|
||||
...sidebarZh.generateSidebarGroups({
|
||||
linkPrefix: '/zh/tags/',
|
||||
}).map(group => ({
|
||||
...group,
|
||||
collapsed: true, // Collapsible and open by default.
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "开发",
|
||||
items: [
|
||||
{ text: "开发配置", link: "/zh/develop/dev-config" },
|
||||
{ text: "组件架构", link: "/zh/develop/comp-arch" },
|
||||
{ text: "插件运行时", link: "/zh/develop/plugin-runtime" },
|
||||
{
|
||||
text: "适配器开发",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "Discord 适配器",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "概述", link: "/zh/develop/adapter/discord/README" },
|
||||
{ text: "快速开始", link: "/zh/develop/adapter/discord/quick_start" },
|
||||
{ text: "架构设计", link: "/zh/develop/adapter/discord/design" },
|
||||
{ text: "API 参考", link: "/zh/develop/adapter/discord/api_reference" },
|
||||
{ text: "故障排除", link: "/zh/develop/adapter/discord/troubleshooting" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
// 编辑链接
|
||||
editLink: {
|
||||
pattern:
|
||||
"https://github.com/langbot-app/Langbot-Wiki/edit/main/docs/:path",
|
||||
},
|
||||
|
||||
// 导航栏的社交图标
|
||||
socialLinks: [
|
||||
{
|
||||
icon: "github",
|
||||
link: "https://github.com/langbot-app/LangBot",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
en: {
|
||||
title: "LangBot Docs",
|
||||
label: "English",
|
||||
lang: "en",
|
||||
link: "/en/",
|
||||
themeConfig: {
|
||||
// https://vitepress.dev/reference/default-theme-config
|
||||
|
||||
nav: [
|
||||
{ text: "Home", link: "https://langbot.app" },
|
||||
{ text: "Roadmap", link: "https://langbot.featurebase.app/roadmap" },
|
||||
],
|
||||
|
||||
sidebar: [
|
||||
{
|
||||
text: "Overview",
|
||||
items: [
|
||||
{ text: "Getting Started (Must Read)", link: "/en/insight/guide" },
|
||||
{ text: "Community Resources", link: "/en/insight/community" },
|
||||
{ text: "Features", link: "/en/insight/features" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Deployment and Usage",
|
||||
items: [
|
||||
{
|
||||
text: "Deploy LangBot",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Package Manager Deployment", link: "/en/deploy/langbot/package" },
|
||||
{ text: "Docker Deployment", link: "/en/deploy/langbot/docker" },
|
||||
{
|
||||
text: "1Panel Deployment",
|
||||
link: "/en/deploy/langbot/one-click/1panel",
|
||||
},
|
||||
{
|
||||
text: "aaPanel Deployment",
|
||||
link: "/en/deploy/langbot/one-click/bt",
|
||||
},
|
||||
{ text: "Manual Deployment", link: "/en/deploy/langbot/manual" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Configure Bots",
|
||||
collapsed: true,
|
||||
link: "/en/deploy/platforms/readme",
|
||||
items: [
|
||||
{ text: "Discord", link: "/en/deploy/platforms/discord" },
|
||||
{ text: "Telegram", link: "/en/deploy/platforms/telegram" },
|
||||
{ text: "Slack", link: "/en/deploy/platforms/slack" },
|
||||
{ text: "LINE", link: "/en/deploy/platforms/line" },
|
||||
{ text: "Lark", link: "/en/deploy/platforms/lark" },
|
||||
{ text: "DingTalk", link: "/en/deploy/platforms/dingtalk" },
|
||||
{
|
||||
text: "OneBot v11",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "NapCat",
|
||||
link: "/en/deploy/platforms/qq/aiocqhttp/napcat",
|
||||
},
|
||||
{
|
||||
text: "Lagrange",
|
||||
link: "/en/deploy/platforms/qq/aiocqhttp/lagrange",
|
||||
},
|
||||
{
|
||||
text: "llonebot",
|
||||
link: "/en/deploy/platforms/qq/aiocqhttp/llonebot",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "QQ Official Bot",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "Webhook Method",
|
||||
link: "/en/deploy/platforms/qq/official_webhook",
|
||||
},
|
||||
{
|
||||
text: "WebSocket Method",
|
||||
link: "/en/deploy/platforms/qq/official",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "WeCom (Enterprise WeChat)",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
text: "Internal Application",
|
||||
link: "/en/deploy/platforms/wecom/wecom",
|
||||
},
|
||||
{
|
||||
text: "External Customer Service",
|
||||
link: "/en/deploy/platforms/wecom/wecomcs",
|
||||
},
|
||||
{
|
||||
text: "Intelligent Bot",
|
||||
link: "/en/deploy/platforms/wecom/wecombot",
|
||||
}
|
||||
],
|
||||
},
|
||||
{ text: "WeChat Official Account", link: "/en/deploy/platforms/wxoa" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Configure Models",
|
||||
link: "/en/deploy/models/readme",
|
||||
},
|
||||
{
|
||||
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: "Langflow", link: "/en/deploy/pipelines/langflow" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Using Knowledge Base",
|
||||
link: "/en/deploy/knowledge/readme",
|
||||
},
|
||||
{
|
||||
text: "Using MCP Services",
|
||||
link: "/en/deploy/mcp/readme",
|
||||
},
|
||||
{
|
||||
text: "System Settings",
|
||||
link: "/en/deploy/settings",
|
||||
},
|
||||
{
|
||||
text: "Dialogue Commands",
|
||||
link: "/en/deploy/command",
|
||||
},
|
||||
{
|
||||
text: "Update LangBot",
|
||||
link: "/en/deploy/update",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Plugins",
|
||||
items: [
|
||||
{ text: "Plugin Introduction", link: "/en/plugin/plugin-intro" },
|
||||
{
|
||||
text: "Plugin Development",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Basic Tutorial", link: "/en/plugin/dev/tutor" },
|
||||
{ text: "Complete Plugin Configuration Information", link: "/en/plugin/dev/basic-info" },
|
||||
{ text: "Directory Structure", link: "/en/plugin/dev/directory-structure" },
|
||||
{
|
||||
text: "Component Development",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Adding Components", link: "/en/plugin/dev/components/add" },
|
||||
{ text: "Component: Event Listener", link: "/en/plugin/dev/components/event-listener" },
|
||||
{ text: "Component: Command", link: "/en/plugin/dev/components/command" },
|
||||
{ text: "Component: Tool", link: "/en/plugin/dev/components/tool" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "API Reference",
|
||||
collapsed: true,
|
||||
items: [
|
||||
{ text: "Plugin Common APIs", link: "/en/plugin/dev/apis/common" },
|
||||
{ text: "Pipeline Events", link: "/en/plugin/dev/apis/pipeline-events" },
|
||||
{ text: "Message Platform Entities", link: "/en/plugin/dev/apis/messages" },
|
||||
],
|
||||
},
|
||||
{ text: "Migration Guide", link: "/en/plugin/dev/migration" },
|
||||
{
|
||||
text: "Distribute Plugin", collapsed: true,
|
||||
items: [
|
||||
{ text: "Publish to Marketplace", link: "/en/plugin/dev/publish/market" },
|
||||
{ text: "Distribute via GitHub", link: "/en/plugin/dev/publish/github" },
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{ text: "System Compatibility", link: "/en/plugin/compatibility" },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Workshops",
|
||||
items: [
|
||||
{
|
||||
text: "How to Implement a Message Platform Adapter?",
|
||||
link: "/en/workshop/impl-platform-adapter",
|
||||
},
|
||||
// {
|
||||
// text: "Integrating Complete MCP Ecosystem in LangBot",
|
||||
// link: "/en/workshop/mcp-details"
|
||||
// },
|
||||
{
|
||||
text: "Container Network Configuration Details",
|
||||
link: "/en/workshop/network-details",
|
||||
},
|
||||
{
|
||||
text: "Using New API to Transmit Models from Multiple Channels",
|
||||
link: "/en/workshop/newapi-integration"
|
||||
},
|
||||
{
|
||||
text: "Integrating PPIO API Model",
|
||||
link: "/en/workshop/ppio-integration"
|
||||
},
|
||||
{
|
||||
text: "Integrating 302.AI Models",
|
||||
link: "/en/workshop/302ai-integration"
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "[Beta] Service API Reference",
|
||||
items: [
|
||||
{ text: "Overview", link: "/en/tags/readme" },
|
||||
...sidebarEn.generateSidebarGroups({
|
||||
linkPrefix: '/en/tags/',
|
||||
}).map(group => ({
|
||||
...group,
|
||||
collapsed: true,
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "Development",
|
||||
items: [
|
||||
{ text: "Development Configuration", link: "/en/develop/dev-config" },
|
||||
{ text: "Component Architecture", link: "/en/develop/comp-arch" },
|
||||
{ text: "Plugin Runtime", link: "/en/develop/plugin-runtime" },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
// edit link
|
||||
editLink: {
|
||||
pattern:
|
||||
"https://github.com/langbot-app/Langbot-Wiki/edit/main/docs/:path",
|
||||
},
|
||||
|
||||
// social links in the navbar
|
||||
socialLinks: [
|
||||
{
|
||||
icon: "github",
|
||||
link: "https://github.com/langbot-app/LangBot",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
// 最后更新时间
|
||||
lastUpdated: true,
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
/* .vitepress/theme/custom.css */
|
||||
:root {
|
||||
/* 自定义主页的hero部分的 name 的字体颜色 */
|
||||
--vp-home-hero-name-color: transparent;
|
||||
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #bd34fe, #41d1ff);
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
// .vitepress/theme/index.ts
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import './custom.css'
|
||||
import { theme, useOpenapi } from 'vitepress-openapi/client'
|
||||
import 'vitepress-openapi/dist/style.css'
|
||||
|
||||
import specZh from '../../assets/service-api-openapi-zh.json'
|
||||
import specEn from '../../assets/service-api-openapi-en.json'
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
enhanceApp({ app, router, siteData }) {
|
||||
// Determine which spec to use based on the current route
|
||||
const getSpec = () => {
|
||||
// Check if we're in the Chinese or English version
|
||||
if (typeof window !== 'undefined') {
|
||||
const path = window.location.pathname
|
||||
return path.startsWith('/zh') ? specZh : specEn
|
||||
}
|
||||
// Default to Chinese spec for SSR
|
||||
return specZh
|
||||
}
|
||||
|
||||
const getLocale = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
const path = window.location.pathname
|
||||
return path.startsWith('/zh') ? 'zh' : 'en'
|
||||
}
|
||||
return 'zh'
|
||||
}
|
||||
|
||||
// Register the openapi spec with custom configuration
|
||||
useOpenapi({
|
||||
spec: getSpec(),
|
||||
config: {
|
||||
// Allow users to customize the server URL in the playground
|
||||
server: {
|
||||
allowCustomServer: true,
|
||||
},
|
||||
// Set locale based on current language
|
||||
i18n: {
|
||||
locale: getLocale(),
|
||||
fallbackLocale: 'en',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
// Update spec when route changes
|
||||
if (router) {
|
||||
router.onAfterRouteChanged = (to) => {
|
||||
const newSpec = to.startsWith('/zh') ? specZh : specEn
|
||||
const newLocale = to.startsWith('/zh') ? 'zh' : 'en'
|
||||
|
||||
useOpenapi({
|
||||
spec: newSpec,
|
||||
config: {
|
||||
server: {
|
||||
allowCustomServer: true,
|
||||
},
|
||||
i18n: {
|
||||
locale: newLocale,
|
||||
fallbackLocale: 'en',
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Then enhance the app with the theme
|
||||
theme.enhanceApp({ app, router, siteData })
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 368 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 152 KiB |
|
Before Width: | Height: | Size: 169 KiB |
@@ -1,29 +0,0 @@
|
||||
# Using Knowledge Base
|
||||
|
||||
LangBot natively supports RAG (Retrieval-Augmented Generation), you can create a knowledge base and bind it to a pipeline, and the pipeline will answer questions based on the content in the knowledge base.
|
||||
|
||||
:::info
|
||||
- You need to configure the embedding model before creating a knowledge base, please read [Configure Models](/en/deploy/models/readme).
|
||||
:::
|
||||
|
||||
## Build Knowledge Base
|
||||
|
||||
In the knowledge base page, click the `Create Knowledge Base` button, fill in the knowledge base name, select the configured embedding model, and click the `Create` button.
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
|
||||
|
||||
## Use Knowledge Base
|
||||
|
||||
Please go to the pipeline configuration, in the "AI" page, select `Local Agent` as the runner, and select the knowledge base you just created below.
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_local_agent.png" alt="use_kb" />
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_kb.png" alt="use_kb" />
|
||||
|
||||
:::info
|
||||
Only when the runner is `Local Agent`, can you use the LangBot native knowledge base, if you want to use the knowledge base with other runners, please refer to the documentation of the corresponding product.
|
||||
:::
|
||||
|
||||
Now you can use the knowledge base to chat in the `Chat Debug` or the robot bound to the pipeline:
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_kb_in_chat.png" alt="use_kb_in_chat" />
|
||||
@@ -1,31 +0,0 @@
|
||||
# Configure Models (Models)
|
||||
|
||||
Models will be used by pipelines to process messages. The first model you configure will be set as the model for the default pipeline.
|
||||
|
||||

|
||||
|
||||
You can add multiple models, and then select which model to use in the pipeline.
|
||||
|
||||

|
||||
|
||||
Enter these four parameters: `Model Name`, `Model Provider`, `Request URL`, and `API Key`, then submit.
|
||||
|
||||
For model capabilities, please choose according to the specific model characteristics:
|
||||
|
||||
- Visual Capability: Needs to be enabled to recognize images
|
||||
|
||||
- Function Calling: Needs to be enabled to use Agent tools in conversations
|
||||
|
||||
:::info
|
||||
|
||||
*If you don't have an API Key, you can [get one from this relay station](https://api.qhaigc.net/)*
|
||||
|
||||
If you need to use third-party API relays or other model providers,
|
||||
|
||||
Select `OpenAI`
|
||||
|
||||
Fill in the relay's Base URL for the Request URL, for example:
|
||||
|
||||

|
||||
|
||||
:::
|
||||
@@ -1,83 +0,0 @@
|
||||
# Connect to Feishu Bot
|
||||
|
||||
## Create Bot
|
||||
|
||||
Go to the [Feishu Open Platform](https://open.feishu.cn/app), log in, and create an enterprise self-built application.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Add bot capability to the application:
|
||||

|
||||
|
||||
Add the permissions shown in the image in the permission management:
|
||||
|
||||

|
||||
|
||||
If card streaming permissions are required, additionally add the following card creation and update permissions as shown in the image:
|
||||
|
||||

|
||||
|
||||
## Connect to LangBot
|
||||
|
||||
Find `app_id` and `app_secret` on the `Credentials and Basic Information` page.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
Open LangBot's Webui configuration page, create a new bot
|
||||
|
||||
Fill in the relevant information in the form
|
||||
|
||||

|
||||
|
||||
Streaming related:
|
||||

|
||||
|
||||
After filling in, start LangBot. If configured successfully, the log will show `[01-29 23:42:56.796] manager.py (68) - [INFO] : Initializing platform adapter 1: lark`, keep LangBot running.
|
||||
|
||||
:::warning
|
||||
By default, WebSocket long connection mode is used, corresponding to the long connection subscription below. But in some cases (such as international version of Feishu), long connection mode is not available, in which case you need to use Webhook mode, corresponding to the `Send events to developer server` mode, please refer to the following configuration:
|
||||
|
||||
- `enable-webhook`: Set to `true`
|
||||
- `encrypt-key`: Set to `Encrypt Key` in the `Encryption Strategy` of the `Events and Callbacks` page
|
||||
|
||||
Note that in Webhook mode, LangBot needs to be deployed on a server with a public IP, and ensure that the firewall has opened the port configured above.
|
||||
:::
|
||||
|
||||
## Configure Event Subscription
|
||||
|
||||
Go to the `Events and Callbacks` page, configure the subscription method as `Long Connection`:
|
||||
|
||||

|
||||
|
||||
And add the event: `Receive Messages`
|
||||
|
||||

|
||||
|
||||
:::warning
|
||||
Webhook mode configuration method:
|
||||
|
||||

|
||||
|
||||
Please start LangBot first, fill in your server address and port here, the path is `/lark/callback`, click `Save`.
|
||||
|
||||
:::
|
||||
|
||||
## Publish Bot
|
||||
|
||||
Click `Create Version` at the top, fill in the version number and other information, click `Save` below.
|
||||
|
||||

|
||||
|
||||
Add the bot to a Feishu group to use it:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Private chat can also be used directly
|
||||
|
||||

|
||||
@@ -1,107 +0,0 @@
|
||||
# Using QQ Official Bot API (Using webhook method)
|
||||
|
||||
This article only provides the deployment of test bots. For the official launch of bots, please follow the [release process](https://q.qq.com/qqbot/#/home).
|
||||
|
||||
## Register QQ Bot (Test Bot)
|
||||
|
||||
### Configure Basic Bot Information
|
||||
|
||||
Go to the [QQ Open Platform](https://q.qq.com/#/), find `Application Management` at the bottom, click Create Bot, fill in the basic information, and then enter the bot page, as shown:
|
||||
|
||||

|
||||
|
||||
The `Release Process` in the `Home` option is the step to launch the bot. Since you are deploying a test version bot, you only need to complete the `Information` and `Sandbox Configuration` sections.<br>
|
||||
|
||||
First fill in the information, then click on Sandbox Configuration.
|
||||
|
||||
#### Configure Sandbox Settings
|
||||
|
||||
Click on `Sandbox Configuration`.
|
||||
If you want to deploy in a QQ group, follow the requirements under `QQ Group ID` to select a group chat, and add users with private chat permissions in the message list configuration.<br>
|
||||
If you want to deploy in a QQ channel, follow the requirements under `Channel ID` to select a channel ID, with bot type 0.
|
||||
|
||||
#### Configure Development Management
|
||||
|
||||
Click on `Development Management`.
|
||||
|
||||

|
||||
|
||||
Record the `AppID`, `Token`, and `AppSecret`, and add the IP address of the server where LangBot is located to the IP whitelist.
|
||||
|
||||
## Connect to LangBot
|
||||
|
||||
Next, open the LangBot configuration page
|
||||
|
||||
Click on Bots, then click Add
|
||||
|
||||
Select `OneBot v11` for `Platform/Adapter Selection`
|
||||
|
||||

|
||||
|
||||
|
||||
## Configure Callback Address
|
||||
|
||||
Since QQ official bots require the callback address to be an https request, but LangBot only provides http, you need to configure a reverse proxy yourself.
|
||||
|
||||
This article recommends using [Caddy](https://caddy2.dengxiaolong.com/docs/) for reverse proxy, with the process as follows.
|
||||
|
||||
### Caddy Operation Process
|
||||
|
||||
#### Install Caddy
|
||||
|
||||
Go to the [Caddy Installation Documentation](https://caddy2.dengxiaolong.com/docs/install). Choose the installation steps for your operating system and install.
|
||||
|
||||
#### Fill in Caddyfile
|
||||
|
||||
This article assumes that LangBot is deployed on an Ubuntu system, where the default location of Caddyfile is `/etc/caddy/Caddyfile`.
|
||||
Use vim or nano to edit Caddyfile, and fill in the Caddyfile as:
|
||||
```json
|
||||
your_domain_name {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
For example, if you have a domain testlb.com that resolves to your machine, and you have port **443** open, fill in:
|
||||
```json
|
||||
testlb.com {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
|
||||
Save and exit the file.
|
||||
|
||||
**Note, the Caddyfile format is very strict, please fill it in correctly. If you encounter problems, please refer to the Caddy documentation or ask AI.**
|
||||
|
||||
#### Start Caddy
|
||||
Enter the command
|
||||
```bash
|
||||
sudo systemctl start caddy
|
||||
```
|
||||
|
||||
After successful startup, check the Caddy status with:
|
||||
```bash
|
||||
sudo systemctl status caddy
|
||||
```
|
||||
|
||||
|
||||
#### Subsequent Configuration
|
||||
|
||||
If Caddy fails to start, please read the [Caddy documentation](https://caddy2.dengxiaolong.com/docs/quick-starts/caddyfile) or join the LangBot community group for help.<br>
|
||||
|
||||
Here are some possible issues:
|
||||
|
||||
- Port 443 is not open
|
||||
- The domain is not resolved to your machine
|
||||
- Caddyfile was not saved successfully
|
||||
|
||||
### Set Management Portal Callback Address
|
||||
|
||||
|
||||
First **start LangBot**.
|
||||
|
||||
Click on `Callback Configuration` in the bot management portal, check all events under `Add Event`. In the request address, enter the domain set in Caddyfile, with the suffix `/callback/command`.
|
||||
|
||||
For example, if the domain is `testlb.com`, then enter `testlb.com/callback/command` in the request address, and click to confirm the configuration. If the callback address is saved successfully, it means the deployment is successful. If you see `Verification Failed`, please carefully check if the above configuration items are filled in correctly.
|
||||
|
||||
## Publication Method
|
||||
|
||||
Enter the release process in `Home` and follow the process to publish and launch the bot.
|
||||
@@ -1,21 +0,0 @@
|
||||
# Configure Bots (Bots)
|
||||
|
||||
Bots are used to receive message events from messaging platforms and call pipelines to process messages.
|
||||
|
||||

|
||||
|
||||
|
||||
| Platform | Status | Notes | Tutorial |
|
||||
| ------ | ---- | ---- | ---- |
|
||||
| Discord | ✅ | | [Tutorial](/en/deploy/platforms/discord) |
|
||||
| Telegram | ✅ | | [Tutorial](/en/deploy/platforms/telegram) |
|
||||
| Slack | ✅ | | [Tutorial](/en/deploy/platforms/slack) |
|
||||
| LINE | ✅ | | [Tutorial](/en/deploy/platforms/line) |
|
||||
| Lark | ✅ | | [Tutorial](/en/deploy/platforms/lark) |
|
||||
| DingTalk | ✅ | | [Tutorial](/en/deploy/platforms/dingtalk) |
|
||||
| WeCom (Enterprise WeChat) | ✅ | Enterprise internal bot | [Tutorial](/en/deploy/platforms/wecom/wecom) |
|
||||
| WeCom Intelligent Bot | ✅ | wecom intelligent bot | [Tutorial](/en/deploy/platforms/wecom/wecombot) |
|
||||
| WeCom Customer Service | ✅ | Enterprise external bot | [Tutorial](/en/deploy/platforms/wecom/wecomcs) |
|
||||
| WeChat Official Account | ✅ | WeChat public platform bot | [Tutorial](/en/deploy/platforms/wxoa) |
|
||||
| OneBot v11 | ✅ | Uses a personal QQ account as a bot, requires an independent protocol client, supports OneBot v11 | [NapCat](/en/deploy/platforms/qq/aiocqhttp/napcat) <br> [Lagrange](/en/deploy/platforms/qq/aiocqhttp/lagrange) <br> [LiteLoaderQQNT](/en/deploy/platforms/qq/aiocqhttp/llonebot) |
|
||||
| QQ Official Bot | ✅ | Connects to the QQ Open Platform bot API | [Tutorial](/en/deploy/platforms/qq/official_webhook) |
|
||||
@@ -1,64 +0,0 @@
|
||||
# Deploy WeCom Bot
|
||||
|
||||
Deploy WeCom (Enterprise WeChat) bot to connect with LangBot.
|
||||
|
||||
:::info
|
||||
This integration method is for internal enterprise applications, used within the enterprise. If you need external customer service, please check the [WeCom Customer Service integration solution](wecomcs.md).
|
||||
:::
|
||||
|
||||
|
||||
## Create Bot
|
||||
|
||||
Enter the [WeCom Admin Portal](https://work.weixin.qq.com/), log in to your account, after entering the main page, click `App Management`, `Build Your Own`, `Create App`, fill in the basic information of the bot, after creation, you will see a page similar to this:
|
||||

|
||||
|
||||
## Set Callback Address
|
||||
|
||||
### Get WeCom Configuration Items
|
||||
|
||||
1. Open the WeCom Admin Portal homepage, click `My Enterprise`, and record the Enterprise ID at the bottom.
|
||||
|
||||

|
||||
|
||||
2. Enable Contact Sync Permission
|
||||
|
||||
:::info
|
||||
- This configuration item is for implementing LangBot's mass messaging feature, the specific code is located in libs/wecom_api/api.py.
|
||||
- LangBot is still under development, so the functionality related to this configuration item has not been implemented yet.
|
||||
- This configuration item can be filled with random characters, but **cannot be empty**.
|
||||
:::
|
||||
|
||||

|
||||
|
||||
Click `Security and Management`, `Management Tools`, `Contact Sync`
|
||||
|
||||

|
||||
|
||||
Click `View Secret`, record it, this is the contacts_secret (Contact Sync Secret).
|
||||
|
||||
3. Click `App Management`, find the bot you just created, view the bot's secret, and record it.
|
||||
|
||||

|
||||
|
||||
At this point, you have obtained three configuration items: corpid (Enterprise ID), secret (Bot Secret), and contacts_secret (Contact Sync Secret).
|
||||
|
||||
### Configure Callback Address
|
||||
|
||||
Enter the bot page.
|
||||
|
||||
Click `Enterprise Trusted IP` at the bottom and add the server where LangBot is deployed.
|
||||
|
||||
Click `Receive Messages`, `Set API Reception`, and start filling in the server message reception configuration.
|
||||
|
||||
Fill in the URL as `http://your_ip_address:2290/callback/command`, where your IP address is the address of the server where LangBot is deployed.
|
||||
|
||||
Click to randomly generate the Token and EncodingAESKey, and record them
|
||||
|
||||
## Connect to LangBot
|
||||
|
||||

|
||||
|
||||
## Save Callback Address
|
||||
When the five configuration items above have been correctly obtained and accurately filled into the WeCom adapter, then **start LangBot**.
|
||||
|
||||
Return to the callback address configuration page and click save. If the above configuration items are filled in correctly, the save will be successful, which means that WeCom and LangBot can communicate (deployment successful). If you see **openapi request callback address failed**, please triple-check that your configuration items are filled in correctly.
|
||||
@@ -1,3 +0,0 @@
|
||||
# Component Architecture
|
||||
|
||||

|
||||
@@ -1,3 +0,0 @@
|
||||
<script setup>
|
||||
window.location.href = '/zh/insight/guide'
|
||||
</script>
|
||||
@@ -1,96 +0,0 @@
|
||||
# Message Platform Entities
|
||||
|
||||
:::info Table of Contents
|
||||
[[toc]]
|
||||
:::
|
||||
|
||||
LangBot supports multiple messaging platforms, and each platform has different `message entity` formats. To abstract away these differences, we have implemented a unified standard. Plugin developers only need to master and use the message entities described on this page in plugins, and LangBot's internal message processing logic can automatically handle message parsing and conversion.
|
||||
|
||||
## Message Chain
|
||||
|
||||
`Messages` on messaging platforms are different from messages used for AI interaction. Messages on messaging platforms are described in the form of `message chains`. Each independent message displayed on QQ is a message chain, which can contain various `message chain components` such as `text`, `images`, `@mentions`, etc. For example:
|
||||
|
||||

|
||||
|
||||
This is a message chain containing one Plain component (Hello World) and one Image component (Usagi).
|
||||
|
||||
The definitions of message chains and message chain components are located in `langbot_plugin.api.entities.platform.message`.
|
||||
|
||||
### Constructing Message Chains
|
||||
|
||||
Please first import the `langbot_plugin.api.entities.platform.message` package to use the message components within it.
|
||||
|
||||
```python
|
||||
from langbot_plugin.api.entities.platform.message import *
|
||||
|
||||
# Build a message containing text "Hello LangBot" and an image (from URL)
|
||||
msg_chain = MessageChain([
|
||||
Plain(text="Hello LangBot"),
|
||||
Image(url='https://qchatgpt.rockchin.top/langbot-logo.png')
|
||||
])
|
||||
|
||||
# Build a message containing @everyone and text "Hello LangBot"
|
||||
msg_chain = MessageChain([
|
||||
AtAll(),
|
||||
Plain(text="Hello LangBot")
|
||||
])
|
||||
|
||||
# Build a message containing @specific member and text "Hello LangBot"
|
||||
msg_chain = MessageChain([
|
||||
At(target=123456),
|
||||
Plain(text="Hello LangBot")
|
||||
])
|
||||
```
|
||||
|
||||
Currently supported message chain components:
|
||||
|
||||
- `Source` - Source message chain information. Messages received from messaging platforms will include this component at the front of the message chain to record message information
|
||||
- `Plain` - Plain text message
|
||||
- `Quote` - Quote message
|
||||
- `Image` - Image message
|
||||
- `AtAll` - @everyone message
|
||||
- `At` - @specific member message
|
||||
- `Voice` - Voice message
|
||||
- Need to check messaging platform support
|
||||
- `Forward` - Forward message
|
||||
- Not supported on many platforms, not recommended
|
||||
- `File` - File message
|
||||
|
||||
When creating components, named parameters must be used. For specific usage, you can check the definitions in the source code `langbot_plugin.api.entities.platform.message`.
|
||||
|
||||
## Other Entities
|
||||
|
||||
In addition to the above entities, there are also entities like `Friend` and `Group`. These entities are defined in `langbot_plugin.api.entities.platform.entities`.
|
||||
|
||||
## Accessing Underlying Platform APIs
|
||||
|
||||
:::warning Note
|
||||
Not applicable for 4.x.
|
||||
:::
|
||||
|
||||
To abstract away platform differences, LangBot provides an abstraction layer above messaging platform APIs, which includes the content described above and various platform adapters in the `pkg/platform/sources` directory.
|
||||
However, due to significant platform differences, the entity and API encapsulation in the abstraction layer is not complete. If your plugin needs to access platform-specific functionality, you can access underlying APIs according to the following instructions.
|
||||
|
||||
:::info
|
||||
The `adapter` here is the instantiated object of each adapter, corresponding to the `xxxAdapter(adapter.MessagePlatformAdapter)` classes in files under `pkg/platform/sources/`. It can be obtained from `query.adapter` in plugin events, for example:
|
||||
|
||||
```python
|
||||
# For example in a plugin
|
||||
@handler(GroupMessageReceived)
|
||||
async def _(self, ctx: EventContext):
|
||||
# Get adapter object
|
||||
adapter = ctx.query.adapter
|
||||
```
|
||||
:::
|
||||
|
||||
| Platform | Adapter | Access Method | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| OneBot v11| aiocqhttp | adapter.bot | bot object corresponds to [aiocqhttp](https://github.com/nonebot/aiocqhttp) CQHttp object, please refer to aiocqhttp documentation for detailed usage |
|
||||
| QQ Official API | qqofficial | adapter.bot | bot object is the SDK object under libs/qq_official_api, for detailed usage please refer to the `send_group_text_msg` method in `QQOfficialClient` in libs/qq_official_api/api.py for HTTP request methods, please refer to QQ Official API documentation for specific interface documentation |
|
||||
| WeCom (Enterprise WeChat) | wecom | adapter.bot | Refer to the `send_image` method in `WecomClient` in libs/wecom_api/api.py for HTTP request methods, please refer to WeCom API documentation for specific interface documentation |
|
||||
| WeChat Official Account | officialaccount | - | Please refer to WeChat Official Account API documentation for interface documentation, credential information can be obtained from adapter.bot |
|
||||
| Lark | lark | adapter.api_client | Lark SDK's API Client object, please refer to [oapi-sdk-python](https://github.com/larksuite/oapi-sdk-python) for details |
|
||||
| DingTalk | dingtalk | - | Please refer to DingTalk API documentation, credential information can be obtained from adapter.bot |
|
||||
| Discord | discord | adapter.bot | bot object is [Rapptz/discord.py](https://github.com/Rapptz/discord.py) Discord object, please refer to documentation for detailed usage |
|
||||
| Telegram | telegram | adapter.bot | bot object is [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) Telegram object, please refer to documentation for detailed usage |
|
||||
| Slack | slack | adapter.bot | bot object in libs/slack_api/api.py, please refer to its code and Slack SDK for detailed usage |
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
aside: false
|
||||
outline: [2, 3]
|
||||
title: Service API
|
||||
---
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { params } = useData()
|
||||
</script>
|
||||
|
||||
<OAOperation :operationId="params.operationId" />
|
||||
@@ -1,18 +0,0 @@
|
||||
import { usePaths } from 'vitepress-openapi'
|
||||
import spec from '../../assets/service-api-openapi-en.json' with { type: 'json' }
|
||||
|
||||
export default {
|
||||
paths() {
|
||||
return usePaths({ spec })
|
||||
.getPathsByVerbs()
|
||||
.filter(item => item && item.operationId)
|
||||
.map(({ operationId, summary }) => {
|
||||
return {
|
||||
params: {
|
||||
operationId,
|
||||
pageTitle: `${summary || operationId} - LangBot API`,
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
aside: false
|
||||
outline: false
|
||||
title: Service API
|
||||
---
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute, useData } from 'vitepress'
|
||||
|
||||
const route = useRoute()
|
||||
const { params } = useData()
|
||||
|
||||
const tag = params.value.tag
|
||||
</script>
|
||||
|
||||
<OASpec :tags="[tag]" hide-info hide-servers hide-paths-summary />
|
||||
@@ -1,17 +0,0 @@
|
||||
import { usePaths } from 'vitepress-openapi'
|
||||
import spec from '../../assets/service-api-openapi-en.json' with { type: 'json' }
|
||||
|
||||
export default {
|
||||
paths() {
|
||||
return usePaths({ spec })
|
||||
.getTags()
|
||||
.map(({ name }) => {
|
||||
return {
|
||||
params: {
|
||||
tag: name,
|
||||
pageTitle: `${name} - LangBot API`,
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# Integrating Models with 302 AI
|
||||
|
||||
Open the WebUI page, and select [302 AI](https://share.302.ai/SuTG99) when adding a model.
|
||||
|
||||

|
||||
@@ -1,3 +0,0 @@
|
||||
<script setup>
|
||||
window.location.href = '/zh/insight/guide'
|
||||
</script>
|
||||
@@ -1,30 +0,0 @@
|
||||
# 使用知识库 (Knowledge Base)
|
||||
|
||||
LangBot 原生支持 RAG(Retrieval-Augmented Generation,即检索增强生成),您可以创建知识库,并将其与流水线绑定,流水线将根据知识库中的内容回答问题。
|
||||
|
||||
:::info
|
||||
- 知识库的创建和使用需要先配置嵌入模型,请先阅读[配置模型](/zh/deploy/models/readme)。
|
||||
:::
|
||||
|
||||
## 构建知识库
|
||||
|
||||
在知识库页面,点击`创建知识库`按钮,填写知识库名称,选择已配置好的嵌入模型,然后点击`创建`按钮。
|
||||
之后请到知识库的“文档”页面,上传文档,LangBot 将会在后台开始解析和索引。
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
|
||||
|
||||
## 使用知识库
|
||||
|
||||
请到流水线配置中,“AI 能力”页,选择`内置 Agent`作为运行器,并在下方选择您刚刚创建的知识库。
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_local_agent.png" alt="use_kb" />
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_kb.png" alt="use_kb" />
|
||||
|
||||
:::info
|
||||
仅当运行器为`内置 Agent`时,才可以使用 LangBot 原生知识库,若要在使用其他运行器时使用知识库,请参考所使用的运行器对应产品的文档。
|
||||
:::
|
||||
|
||||
现在即可在`对话调试`或流水线所绑定的机器人上使用知识库进行对话:
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/knowledge/use_kb_in_chat.png" alt="use_kb_in_chat" />
|
||||
@@ -1,42 +0,0 @@
|
||||
# Docker部署
|
||||
|
||||
:::warning
|
||||
建议您先学习以下内容:
|
||||
|
||||
- `Docker` 和 `Docker Compose` 的使用
|
||||
- Docker 容器间网络通信配置方式
|
||||
:::
|
||||
|
||||
:::info
|
||||
- 请先确保 Git、 Docker 和 Docker Compose 已安装
|
||||
- 推荐使用[阿里云,服务器价格低至 38 元一年,更可以享受8折优惠](https://www.aliyun.com/minisite/goods?userCode=ys4ad8gs)
|
||||
:::
|
||||
|
||||
Git 克隆本项目:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/langbot-app/LangBot
|
||||
cd LangBot/docker
|
||||
```
|
||||
|
||||
启动容器:
|
||||
|
||||
```bash
|
||||
docker compose up
|
||||
```
|
||||
|
||||
:::info
|
||||
- 如果你的主机位于中国大陆,可以把上方命令的`https://github.com/langbot-app/LangBot`改为`https://gitcode.com/RockChinQ/LangBot`以使用国内镜像源。
|
||||
- 如果你的主机位于中国大陆,可以考虑把 `docker-compose.yaml` 文件中的镜像名称改为`docker.langbot.app/langbot-public/rockchin/langbot:latest`以使用我们提供的镜像源。
|
||||
- 推荐[设置 Docker 容器代理](https://yeasy.gitbook.io/docker_practice/advanced_network/http_https_proxy),以便保证 LangBot 在运行期间的网络访问通畅。
|
||||
:::
|
||||
|
||||
首次启动会输出创建配置文件的提示,请继续按照文件配置。
|
||||
|
||||
容器会映射`5300`端口供 WebUI 使用,您可以访问`http://127.0.0.1:5300`查看 WebUI。
|
||||
还会映射`2280-2290`端口供使用 OneBot 协议的消息平台适配器反向连接。
|
||||
|
||||
完成 LangBot 部署后,请继续阅读:
|
||||
|
||||
- [配置机器人文档](/zh/deploy/platforms/readme)。
|
||||
- [配置模型文档](/zh/deploy/models/readme)。
|
||||
@@ -1,37 +0,0 @@
|
||||
# 使用MCP服务器
|
||||
|
||||
|
||||
LangBot 支持 SSE 模式 MCP 服务器,您可以添加 MCP 服务器,使用大语言模型中的工具调用特性,更好的处理 LLM 请求。
|
||||
|
||||
:::info
|
||||
- MCP 服务仅支持 SSE 模式。
|
||||
- MCP 服务器推荐获取渠道:[ModelScope](https://modelscope.cn/mcp)
|
||||
:::
|
||||
|
||||
## 打开模型的函数调用功能
|
||||
|
||||
如图,将模型的`函数调用`功能打开。
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/mcp/mcp_01.png" alt="enable function call" />
|
||||
|
||||
## 创建MCP服务器
|
||||
|
||||
点击`插件管理` -> `MCP管理`,如图所示:
|
||||
|
||||
<img width="1000px" src="/assets/image/zh/deploy/mcp/mcp02.png" alt="server page" />
|
||||
|
||||
点击右上角的`添加`,选择`添加 MCP 服务器`,
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/mcp/mcp03.png" alt="create new mcp server" />
|
||||
|
||||
比如使用 Fetch HTML 服务器,填写对应的 URL,点击`测试`用来测试 MCP 服务器,点`提交`添加此服务器。
|
||||
|
||||
添加完成之后,点击卡片上的开关以连接 MCP 服务器,点击卡片可以看到 MCP 服务器的详情:
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/mcp/mcp05.png" alt="detailed server" />
|
||||
|
||||
## 效果
|
||||
|
||||
需要在流水线设置中选用 `内置 Agent` 作为运行器,并使用支持函数调用的模型。
|
||||
|
||||
<img width="1000px" src="/assets/image/zh/deploy/mcp/mcp04.png" alt="dialog with mcp" />
|
||||
@@ -1,41 +0,0 @@
|
||||
# 配置模型 (Models)
|
||||
|
||||
## 对话模型 (LLM Model)
|
||||
|
||||
对话模型将被流水线用于处理消息,您配置的第一个模型将被设置为默认流水线的模型。
|
||||
|
||||

|
||||
|
||||
可以添加多个模型,然后再流水线中选择具体使用什么模型
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/models/model_config.png" alt="model_config" />
|
||||
|
||||
填入这四个参数`模型名称`、`模型供应商`、`请求 URL`、`API Key`,然后提交即可
|
||||
|
||||
模型能力方面,请根据具体模型特性来选择:
|
||||
|
||||
- 视觉能力:需要启用才可以识图
|
||||
|
||||
- 函数调用:需要启用才可以在对话中使用 Agent 工具
|
||||
|
||||
:::info
|
||||
|
||||
*如果你没有API Key,你可以[在此中转站获取](https://api.qhaigc.net/)*
|
||||
|
||||
如果需要使用第三方中转 API 等模型提供商
|
||||
|
||||
选择 `OpenAI`即可
|
||||
|
||||
请求 URL 填入中转的 Base URL 即可,例如
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/models/other_provider.png" alt="other_provider" />
|
||||
|
||||
:::
|
||||
|
||||
## 嵌入模型 (Embedding Model)
|
||||
|
||||
嵌入模型将被用于计算消息的向量,若您需要使用知识库,请配置此模型。
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/models/embedding_model.png" alt="embedding_model" />
|
||||
|
||||
填入这四个参数`模型名称`、`模型供应商`、`请求 URL`、`API Key`,然后提交即可,之后请在知识库中配置使用此模型。
|
||||
@@ -1,83 +0,0 @@
|
||||
# 接入飞书机器人
|
||||
|
||||
## 创建机器人
|
||||
|
||||
前往[飞书开放平台](https://open.feishu.cn/app),登录后,创建企业自建应用。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
为应用添加机器人能力:
|
||||

|
||||
|
||||
在权限管理中添加图中所示权限:
|
||||
|
||||

|
||||
|
||||
如需卡片流式权限则多添加如下图的创建与更新卡片:
|
||||
|
||||

|
||||
|
||||
## 对接 LangBot
|
||||
|
||||
在`凭证与基础信息`页找到`app_id`和`app_secret`。
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
打开LangBot 的 Webui 配置页面,创建一个新的机器人
|
||||
|
||||
将相关信息填入表单
|
||||
|
||||

|
||||
|
||||
流式相关:
|
||||

|
||||
|
||||
填写完成后启动 LangBot,若成功配置,日志中会出现`[01-29 23:42:56.796] manager.py (68) - [INFO] : 初始化平台适配器 1: lark`的字样,保持 LangBot 运行。
|
||||
|
||||
:::warning
|
||||
默认使用的是 WebSocket 长连接模式,对应下方的长连接订阅。但某些情况下(如国际版飞书)不具有长连接模式,此时需要使用 Webhook 模式,对应`将事件发送到开发者服务器`模式,请参考以下配置:
|
||||
|
||||
- `enable-webhook`:设置为`true`
|
||||
- `encrypt-key`:设置为`事件与回调`页面的`加密策略`中的`Encrypt Key`
|
||||
|
||||
注意,在Webhook模式中,LangBot 需要部署在具有公网 IP 的服务器上,并确保防火墙已开放上方配置的端口。
|
||||
:::
|
||||
|
||||
## 配置事件订阅
|
||||
|
||||
前往`事件与回调`页,配置订阅方式为`长连接`:
|
||||
|
||||

|
||||
|
||||
并添加事件:`接收消息`
|
||||
|
||||

|
||||
|
||||
:::warning
|
||||
Webhook 模式配置方式:
|
||||
|
||||

|
||||
|
||||
请先启动 LangBot,在此处填写你的服务器地址和端口,路径为`/lark/callback`,点击`保存`。
|
||||
|
||||
:::
|
||||
|
||||
## 发布机器人
|
||||
|
||||
点击顶部`创建版本`,填写版本号等信息,点击下方`保存`。
|
||||
|
||||

|
||||
|
||||
在飞书群中添加机器人,即可使用:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
私聊也可以直接使用
|
||||
|
||||

|
||||
@@ -1,107 +0,0 @@
|
||||
# 使用 QQ 官方机器人 API(使用webhook方式)
|
||||
|
||||
本文章只提供测试版机器人的发布,具体机器人上线请按照 [发布流程](https://q.qq.com/qqbot/#/home) 进行部署。
|
||||
|
||||
## 注册 QQ 机器人(测试机器人)
|
||||
|
||||
### 配置机器人基本信息
|
||||
|
||||
前往 [QQ开放平台](https://q.qq.com/#/) ,找到下方的 `应用管理` ,点击创建机器人,填写基本信息之后,进入机器人页面,如图:
|
||||
|
||||

|
||||
|
||||
`首页` 选项中的 `发布流程` 即为上线机器人的步骤。由于部署的是测试版机器人,所以只需要进行其中的 `资料` 和 `沙箱配置` 。<br>
|
||||
|
||||
先进行资料填写,然后点击沙箱配置。
|
||||
|
||||
#### 配置沙箱配置项
|
||||
|
||||
点击 `沙箱配置` 。
|
||||
如果要部署在QQ群中,那么按照 `QQ群ID` 下方的要求进行选择群聊,在消息列表配置中添加有私聊权限的用户。<br>
|
||||
如果要部署在QQ频道中,那么按照 `频道ID` 下方的要求选择频道ID,机器人类型为0。
|
||||
|
||||
#### 配置开发管理项
|
||||
|
||||
点击 `开发管理` 。
|
||||
|
||||

|
||||
|
||||
记录其中的 `AppID` , `Token` , `AppSecret` ,并将 LangBot 所在服务器的IP地址填写到IP白名单中。
|
||||
|
||||
## 对接 LangBot
|
||||
|
||||
接下来打开 LangBot 配置页面
|
||||
|
||||
点击机器人,点击添加
|
||||
|
||||
`平台/适配器选择`为`OneBot v11`
|
||||
|
||||

|
||||
|
||||
|
||||
## 配置回调地址
|
||||
|
||||
由于QQ官方机器人必须要求回调地址是 https 请求,但 LangBot 仅提供 http 方式,所以需要自行配置反向代理。
|
||||
|
||||
本文建议使用 [Caddy](https://caddy2.dengxiaolong.com/docs/) 反向代理,操作流程如下文。
|
||||
|
||||
### 操作caddy流程
|
||||
|
||||
#### 安装caddy
|
||||
|
||||
进入[Caddy安装文档](https://caddy2.dengxiaolong.com/docs/install)。选择对应自己操作系统的安装步骤,进行安装。
|
||||
|
||||
#### 填写Caddyfile
|
||||
|
||||
本文假设使用 ubuntu 系统部署 LangBot ,那么在系统中,Caddyfile 的默认位置为 `/etc/caddy/Caddyfile`。
|
||||
使用 vim 或 nano 编辑 Caddyfile ,Caddyfile文件填写为:
|
||||
```json
|
||||
your_domain_name {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
例如,如果你有域名 testlb.com,并且解析地址为本机,同时开启**443**端口,那么填写为:
|
||||
```json
|
||||
testlb.com {
|
||||
reverse_proxy 127.0.0.1:2284
|
||||
}
|
||||
```
|
||||
|
||||
保存并且退出文件。
|
||||
|
||||
**注,Caddyfile文件的填写要求非常严苛,请按照正确的格式填写,如果遇到问题请自行查询Caddy文档或者询问AI。**
|
||||
|
||||
#### 启动caddy
|
||||
输入命令
|
||||
```bash
|
||||
sudo systemctl start caddy
|
||||
```
|
||||
|
||||
成功启动后,检查 Caddy 状态命令:
|
||||
```bash
|
||||
sudo systemctl status caddy
|
||||
```
|
||||
|
||||
|
||||
#### 后续配置
|
||||
|
||||
若 Caddy 启动不成功,请自行阅读 [Caddy文档](https://caddy2.dengxiaolong.com/docs/quick-starts/caddyfile),或者加入 LangBot 社区群请求帮助。<br>
|
||||
|
||||
以下是一些可能出现的问题:
|
||||
|
||||
- 没有开启443端口
|
||||
- 没有将域名解析到本机
|
||||
- 没有成功保存 Caddyfile
|
||||
|
||||
### 设置管理端回调地址
|
||||
|
||||
|
||||
首先 **启动 LangBot** 。
|
||||
|
||||
点击 机器人管理端网页中的 `回调配置`,勾选下面 `添加事件` 中的所有事件。 在请求地址中填写 Caddyfile 中设置的域名,后缀为`/callback/command`。
|
||||
|
||||
比如域名为 `testlb.com`,那么请求地址中填写 `testlb.com/callback/command` ,点击确定配置。如果回调地址保存成功,那么意味着部署成功。若出现 `校验失败` 字样,请认真检查上述配置项是否填写正确。
|
||||
|
||||
## 发布方式
|
||||
|
||||
进入 `首页` 的发布流程 ,按照流程进行机器人发布,上线。
|
||||
@@ -1,21 +0,0 @@
|
||||
# 配置机器人 (Bots)
|
||||
|
||||
机器人用于从消息平台接收消息事件并调用流水线处理消息。
|
||||
|
||||

|
||||
|
||||
|
||||
| 平台 | 状态 | 备注 |教程 |
|
||||
| ------ | ---- | ---- | ---- |
|
||||
| OneBot v11 | ✅ | 使用普通的 QQ 号作为机器人,需要使用独立的协议端,支持 OneBot v11 | [NapCat](/zh/deploy/platforms/qq/aiocqhttp/napcat) <br> [Lagrange](/zh/deploy/platforms/qq/aiocqhttp/lagrange) <br> [LiteLoaderQQNT](/zh/deploy/platforms/qq/aiocqhttp/llonebot) |
|
||||
| QQ 官方机器人 | ✅ | 接入 QQ 开放平台的机器人 API | [教程](/zh/deploy/platforms/qq/official_webhook) |
|
||||
| 企业微信 | ✅ | 企业内部机器人 | [教程](/zh/deploy/platforms/wecom/wecom) |
|
||||
| 企业微信客服 | ✅ | 企业对外机器人 | [教程](/zh/deploy/platforms/wecom/wecomcs) |
|
||||
| 企业微信智能机器人 | ✅ | 智能机器人 | [教程](/zh/deploy/platforms/wecom/wecombot) |
|
||||
| 微信公众号 | ✅ | 微信公众平台机器人 | [教程](/zh/deploy/platforms/wxoa.md) |
|
||||
| 飞书 | ✅ | | [教程](/zh/deploy/platforms/lark) |
|
||||
| 钉钉 | ✅ | | [教程](/zh/deploy/platforms/dingtalk) |
|
||||
| Discord | ✅ | | [教程](/zh/deploy/platforms/discord) |
|
||||
| Telegram | ✅ | | [教程](/zh/deploy/platforms/telegram) |
|
||||
| Slack | ✅ | | [教程](/zh/deploy/platforms/slack) |
|
||||
| LINE | ✅ | | [教程](/zh/deploy/platforms/line) |
|
||||
@@ -1,75 +0,0 @@
|
||||
# 部署企业微信机器人
|
||||
|
||||
部署企业微信机器人接入 LangBot 。
|
||||
|
||||
:::info
|
||||
此种接入方式为企业内部自建应用,是在企业内部使用的,若需要对外接待,请查看[企业微信客服接入方案](wecomcs.md)。
|
||||
:::
|
||||
|
||||
|
||||
## 创建机器人
|
||||
|
||||
进入[企业微信管理后台](https://work.weixin.qq.com/),登陆账号,进入主页面后,点击` 应用管理 `,` 自建 `,` 创建应用 `,填写机器人基本信息,创建好之后,会出现类似这样的界面:
|
||||

|
||||
|
||||
## 设置回调地址
|
||||
|
||||
### 获取企业微信配置项
|
||||
|
||||
1. 打开企业微信管理后台主页,点击`我的企业`,记录下最下面的企业ID。
|
||||
|
||||

|
||||
|
||||
2. 开启通讯录同步权限
|
||||
|
||||
:::info
|
||||
- 此配置项是为了实现 LangBot 的群发消息,具体代码位于libs/wecom_api/api.py 。
|
||||
- 目前 LangBot 仍在开发,所以未实现此配置项的相关功能。
|
||||
- 此配置项可以填写入随机字符,**不能为空**。
|
||||
:::
|
||||
|
||||

|
||||
|
||||
点击`安全与管理`,`管理工具`,`通讯录同步`
|
||||
|
||||

|
||||
|
||||
点击`查看secret`,记录下来,这是 contacts_secret(通讯录同步 secret)。
|
||||
|
||||
3. 点击`应用管理`,找到刚才创建的机器人,查看机器人的 secret ,记录下来。
|
||||
|
||||

|
||||
|
||||
至此,已经获得了三个配置项,分别是 corpid(企业ID),secret(机器人 secret),contacts_secret(通讯录同步 secret)。
|
||||
|
||||
### 配置回调地址
|
||||
|
||||
进入机器人页面。
|
||||
|
||||
点击最下方的`企业可信IP`,将部署 LangBot 的服务器添加进去。
|
||||
|
||||
点击` 接收消息 `,` 设置API接收 `,开始填写接收服务器消息配置。
|
||||
|
||||
URL填写为` http://your_ip_address:2290/callback/command `,你的IP地址就是部署LangBot的服务器的地址。
|
||||
|
||||
Token 和 EncodingAESKey 点击随机获取,并记录下来
|
||||
|
||||
## 对接 LangBot
|
||||
|
||||

|
||||
|
||||
## 保存回调地址
|
||||
当前面五个配置项已经正确获取,并且准确的填入到企业微信适配器中,那么**启动 LangBot**。
|
||||
|
||||
回到配置回调地址页面并且点击保存,如果以上的配置项填写正确,那么可以保存成功,这意味着企业微信和 LangBot 可以进行通信(部署成功),如果出现**openapi 请求回调地址不通过**,请再三检查你的配置项填写是否正确。
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# 组件架构
|
||||
|
||||

|
||||
@@ -1,3 +0,0 @@
|
||||
<script setup>
|
||||
window.location.href = '/zh/insight/guide'
|
||||
</script>
|
||||
@@ -1,97 +0,0 @@
|
||||
# 消息平台实体
|
||||
|
||||
:::info 目录
|
||||
[[toc]]
|
||||
:::
|
||||
|
||||
LangBot 支持多种消息平台,每个消息平台的`消息实体`格式均不相同。为了屏蔽这些差异,我们实现了一套统一的标准。插件开发者只需要掌握并在插件中使用此页所述的消息实体,LangBot 内部的消息处理逻辑能够自动完成消息的解析和转换。
|
||||
|
||||
## 消息链
|
||||
|
||||
消息平台的`消息`不同于用于 AI 交互的消息,消息平台的消息以`消息链`的形式描述,QQ 上展示的每一个独立的消息就是一条消息链,消息链中可以包含`文字`、`图片`、`@组件`等多种`消息链组件`,例如:
|
||||
|
||||

|
||||
|
||||
这就是一个消息链,包含 一个 Plain 组件(Hello World)和 一个 Image 组件(乌萨奇)
|
||||
|
||||
消息链和消息链组件的定义位于`langbot_plugin.api.entities.platform.message`中。
|
||||
|
||||
### 构造消息链
|
||||
|
||||
请先引入`langbot_plugin.api.entities.platform.message`包,才能使用其中的消息组件。
|
||||
|
||||
```python
|
||||
from langbot_plugin.api.entities.platform.message import *
|
||||
|
||||
# 构建一个包含文字 Hello LangBot 和图片(从URL获取)的消息
|
||||
msg_chain = MessageChain([
|
||||
Plain(text="Hello LangBot"),
|
||||
Image(url='https://qchatgpt.rockchin.top/langbot-logo.png')
|
||||
])
|
||||
|
||||
# 构建一个包含 @全体成员 和文字 Hello LangBot 的消息
|
||||
msg_chain = MessageChain([
|
||||
AtAll(),
|
||||
Plain(text="Hello LangBot")
|
||||
])
|
||||
|
||||
# 构建一个包含 @指定成员 和文字 Hello LangBot 的消息
|
||||
msg_chain = MessageChain([
|
||||
At(target=123456),
|
||||
Plain(text="Hello LangBot")
|
||||
])
|
||||
```
|
||||
|
||||
目前支持的消息链组件:
|
||||
|
||||
- `Source` 源消息链信息,如果是从消息平台收到的消息,都会在消息链最前端包含此组件,记录消息信息
|
||||
- `Plain` 纯文本消息
|
||||
- `Quote` 引用消息
|
||||
- `Image` 图片消息
|
||||
- `AtAll` @全体成员消息
|
||||
- `At` @指定成员消息
|
||||
- `Voice` 语音消息
|
||||
- 需要检查消息平台支持性
|
||||
- `Forward` 转发消息
|
||||
- 在很多平台不受支持,不建议使用
|
||||
- `File` 文件消息
|
||||
|
||||
创建组件时,须使用具名参数传入。具体使用方式可以查看源码`langbot_plugin.api.entities.platform.message`中的定义。
|
||||
|
||||
## 其他实体
|
||||
|
||||
除了上述实体之外,还有`好友 Friend`和`群 Group`等实体,这些实体的定义位于`langbot_plugin.api.entities.platform.entities`中。
|
||||
|
||||
## 访问消息平台底层 API
|
||||
|
||||
:::warning 注意
|
||||
4.x 暂不适用。
|
||||
:::
|
||||
|
||||
为了抹平各个平台的差异,LangBot 在消息平台API之上,提供了一个抽象层,即上方所述的内容,以及`pkg/platform/sources`目录下的各个平台适配器。
|
||||
但由于各个平台的差异较大,抽象层内的实体和 API 封装并不完整,如果您的插件需要访问特定平台的功能,可以按照以下说明访问底层 API。
|
||||
|
||||
:::info
|
||||
其中的`adapter`为每个适配器的实例化对象,对应 `pkg/platform/sources/` 下各个文件中的 `xxxAdapter(adapter.MessagePlatformAdapter)` 类。可以在插件事件的`query.adapter`中取得,例如:
|
||||
|
||||
```python
|
||||
# 例如在插件中
|
||||
@handler(GroupMessageReceived)
|
||||
async def _(self, ctx: EventContext):
|
||||
# 取得适配器对象
|
||||
adapter = ctx.query.adapter
|
||||
```
|
||||
:::
|
||||
|
||||
|
||||
| 平台 | 适配器 | 访问方式 | 说明 |
|
||||
| --- | --- | --- | --- |
|
||||
| OneBot v11| aiocqhttp | adapter.bot | bot 对象对应 [aiocqhttp](https://github.com/nonebot/aiocqhttp) 的 CQHttp 对象,详细使用方式请参考 aiocqhttp 文档 |
|
||||
| QQ 官方API | qqofficial | adapter.bot | bot 对象为 libs/qq_official_api 下的 SDK 对象,详细使用方式可以参考 libs/qq_official_api/api.py 中`QQOfficialClient`中的`send_group_text_msg`方法发起 HTTP 请求的方式,具体接口文档请查看 QQ 官方 API 文档|
|
||||
| 企业微信 | wecom | adapter.bot | 参考 libs/wecom_api/api.py 中`WecomClient`中的`send_image`方法发起 HTTP 请求的方式,具体接口文档请查看企业微信 API 文档 |
|
||||
| 微信公众号 | officialaccount | - | 请参考微信公众号的 API 文档中的接口文档信息,相关的凭据信息可以在 adapter.bot 中取得 |
|
||||
| 飞书 | lark | adapter.api_client | 飞书 SDK 的 API Client 对象,具体请参考[oapi-sdk-python](https://github.com/larksuite/oapi-sdk-python) |
|
||||
| 钉钉 | dingtalk | - | 请参考钉钉 API 文档,相关的凭据信息可以在 adapter.bot 中取得 |
|
||||
| Discord | discord | adapter.bot | bot 对象为 [Rapptz/discord.py](https://github.com/Rapptz/discord.py) 的 Discord 对象,详细使用方式请参考文档 |
|
||||
| Telegram | telegram | adapter.bot | bot 对象为 [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) 的 Telegram 对象,详细使用方式请参考文档 |
|
||||
| Slack | slack | adapter.bot | bot 对象 libs/slack_api/api.py 中的对象,详细使用方式请参考其代码以及 Slack SDK |
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
aside: false
|
||||
outline: [2, 3]
|
||||
title: Service API
|
||||
---
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { params } = useData()
|
||||
</script>
|
||||
|
||||
<OAOperation :operationId="params.operationId" />
|
||||
@@ -1,18 +0,0 @@
|
||||
import { usePaths } from 'vitepress-openapi'
|
||||
import spec from '../../assets/service-api-openapi-zh.json' with { type: 'json' }
|
||||
|
||||
export default {
|
||||
paths() {
|
||||
return usePaths({ spec })
|
||||
.getPathsByVerbs()
|
||||
.filter(item => item && item.operationId)
|
||||
.map(({ operationId, summary }) => {
|
||||
return {
|
||||
params: {
|
||||
operationId,
|
||||
pageTitle: `${summary || operationId} - LangBot API`,
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
aside: false
|
||||
outline: false
|
||||
title: Service API
|
||||
---
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useRoute, useData } from 'vitepress'
|
||||
|
||||
const route = useRoute()
|
||||
const { params } = useData()
|
||||
|
||||
const tag = params.value.tag
|
||||
</script>
|
||||
|
||||
<OASpec :tags="[tag]" hide-info hide-servers hide-paths-summary />
|
||||
@@ -1,18 +0,0 @@
|
||||
import { usePaths } from 'vitepress-openapi'
|
||||
import spec from '../../assets/service-api-openapi-zh.json' with { type: 'json' }
|
||||
|
||||
export default {
|
||||
paths() {
|
||||
return usePaths({ spec })
|
||||
.getTags()
|
||||
.map(({ name }) => {
|
||||
return {
|
||||
params: {
|
||||
tag: name,
|
||||
pageTitle: `${name} - LangBot API`,
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# 接入 302.AI 的模型
|
||||
|
||||
打开 WebUI 页面,添加模型时选择[302.AI](https://share.302.ai/SuTG99)即可
|
||||
|
||||

|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Command
|
||||
---
|
||||
title: "Command"
|
||||
---
|
||||
|
||||
LangBot will regard messages starting with `!` as commands. Official provides [`EssentialCommands` plugin](https://space.langbot.app/market?author=langbot-team&plugin=EssentialCommands), which includes commonly used commands.
|
||||
|
||||
You can also develop your own command plugin, please refer to [Command Plugin Development](/en/plugin/dev/components/command.md).
|
||||
You can also develop your own command plugin, please refer to [Command Plugin Development](/en/plugin/dev/components/command).
|
||||
@@ -1,33 +1,35 @@
|
||||
# Docker Deployment
|
||||
|
||||
:::warning
|
||||
It is recommended that you first learn the following:
|
||||
|
||||
- Usage of `Docker` and `Docker Compose`
|
||||
- Docker container network communication configuration methods
|
||||
:::
|
||||
|
||||
:::info
|
||||
- Please ensure Git, Docker, and Docker Compose are installed
|
||||
:::
|
||||
|
||||
Clone the project:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/langbot-app/LangBot
|
||||
cd LangBot/docker
|
||||
```
|
||||
|
||||
Start the container:
|
||||
|
||||
```bash
|
||||
docker compose up
|
||||
```
|
||||
|
||||
The container maps port `5300` for WebUI access. You can visit `http://127.0.0.1:5300` to view the WebUI.
|
||||
It also maps ports `2280-2290` for reserved for message platform adapters.
|
||||
|
||||
After completing the LangBot deployment, please continue reading:
|
||||
|
||||
- [Bot Configuration Documentation](/en/deploy/platforms/readme).
|
||||
- [Model Configuration Documentation](/en/deploy/models/readme).
|
||||
---
|
||||
title: "Docker Deployment"
|
||||
---
|
||||
|
||||
<Warning>
|
||||
Before you start, you may learn about in advanced:
|
||||
|
||||
- Usage of `Docker` and `Docker Compose`
|
||||
- Docker container network communication configuration methods
|
||||
</Warning>
|
||||
|
||||
<Info>
|
||||
- Please ensure Git, Docker, and Docker Compose are installed
|
||||
</Info>
|
||||
|
||||
Clone the project:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/langbot-app/LangBot
|
||||
cd LangBot/docker
|
||||
```
|
||||
|
||||
Start the container:
|
||||
|
||||
```bash
|
||||
docker compose up
|
||||
```
|
||||
|
||||
The container maps port `5300` for WebUI access. You can visit `http://127.0.0.1:5300` to view the WebUI.\
|
||||
It also maps ports `2280-2290` for reserved for message platform adapters.
|
||||
|
||||
After completing the LangBot deployment, please continue reading:
|
||||
|
||||
- [Bot Configuration Documentation](/en/deploy/platforms/readme).
|
||||
- [Model Configuration Documentation](/en/deploy/models/readme).
|
||||
@@ -1,46 +1,43 @@
|
||||
# Manual Deployment
|
||||
|
||||
:::warning
|
||||
1. Please use Python 3.10.1 (not including 3.10.0) or higher version, 3.10.14 is recommended. You need to install Python if you don't have it.
|
||||
2. This method is not recommended, manual deployment may not be supported in the future. Please consider using Docker deployment.
|
||||
:::
|
||||
|
||||
## Installing the Main Program
|
||||
|
||||
1. Go to the [Release](https://github.com/langbot-app/LangBot/releases) page to download the latest version of the zip package (recommended) `langbot-xxx-all.zip` (do not download Source Code as it does not include WebUI). Extract it and open a command line (terminal) in the extracted directory.
|
||||
|
||||

|
||||
|
||||
2. Install dependencies
|
||||
|
||||
We use [uv](https://docs.astral.sh/uv/) to manage dependencies.
|
||||
|
||||
```bash
|
||||
pip install uv
|
||||
uv sync
|
||||
```
|
||||
|
||||
3. Run the main program once to generate configuration files
|
||||
|
||||
```bash
|
||||
uv run main.py
|
||||
```
|
||||
|
||||
You will see the following message:
|
||||
|
||||
```
|
||||
_ ___ _
|
||||
| | __ _ _ _ __ _| _ ) ___| |_
|
||||
| |__/ _` | ' \/ _` | _ \/ _ \ _|
|
||||
|____\__,_|_||_\__, |___/\___/\__|
|
||||
|___/
|
||||
|
||||
⭐️Open Source: https://github.com/langbot-app/LangBot
|
||||
📖Documentation: https://docs.langbot.app
|
||||
|
||||
The following files do not exist and have been automatically generated. Please modify the configuration files as needed and restart:
|
||||
- data/config.yaml
|
||||
...
|
||||
```
|
||||
|
||||
You can now use Ctrl+C to exit the program and continue to the [Deploy Bots](/en/deploy/platforms/readme) page.
|
||||
---
|
||||
title: "Manual Deployment"
|
||||
---
|
||||
|
||||
## Installing the Main Program
|
||||
|
||||
1. Go to the [Release](https://github.com/langbot-app/LangBot/releases) page to download the latest version of the zip package (recommended) `langbot-xxx-all.zip` (do not download Source Code as it does not include WebUI). Extract it and open a command line (terminal) in the extracted directory.
|
||||
|
||||

|
||||
|
||||
2. Install dependencies
|
||||
|
||||
We use [uv](https://docs.astral.sh/uv/) to manage dependencies.
|
||||
|
||||
```bash
|
||||
pip install uv
|
||||
uv sync
|
||||
```
|
||||
|
||||
3. Run the main program once to generate configuration files
|
||||
|
||||
```bash
|
||||
uv run main.py
|
||||
```
|
||||
|
||||
You will see the following message:
|
||||
|
||||
```
|
||||
_ ___ _
|
||||
| | __ _ _ _ __ _| _ ) ___| |_
|
||||
| |__/ _` | ' \/ _` | _ \/ _ \ _|
|
||||
|____\__,_|_||_\__, |___/\___/\__|
|
||||
|___/
|
||||
|
||||
⭐️Open Source: https://github.com/langbot-app/LangBot
|
||||
📖Documentation: https://docs.langbot.app
|
||||
|
||||
The following files do not exist and have been automatically generated. Please modify the configuration files as needed and restart:
|
||||
- data/config.yaml
|
||||
...
|
||||
```
|
||||
|
||||
You can now use Ctrl+C to exit the program and continue to the [Deploy Bots](/en/deploy/platforms/readme) page.
|
||||
@@ -1,19 +1,9 @@
|
||||
# 1Panel Deployment
|
||||
---
|
||||
title: "1Panel Deployment"
|
||||
---
|
||||
|
||||
Deploy LangBot with one click using [1Panel](https://www.bt.cn/new/download.html?r=dk_LangBot).
|
||||
|
||||
:::warning
|
||||
|
||||
Unless you plan to use messaging platforms that do not require additional containers (such as Discord or Lark), or you are familiar with the network connection between Docker containers on 1Panel, it is not recommended to use the one-click deployment of 1Panel. Please consider using [Docker Deployment](/en/deploy/langbot/docker) instead.
|
||||
|
||||
:::
|
||||
|
||||
:::info
|
||||
|
||||
With [Alibaba Cloud](https://www.aliyun.com/minisite/goods?userCode=ys4ad8gs), you can get a server for as low as 38 yuan per year, and even enjoy a 20% discount. It is more convenient to install 1Panel with one click.
|
||||
|
||||
:::
|
||||
|
||||
## Install 1Panel
|
||||
|
||||
> Recommended server systems (from 1Panel): Debian 12, Ubuntu 22, etc.
|
||||
@@ -22,9 +12,7 @@ This article assumes that the server has a public IPv4 address by default. If yo
|
||||
|
||||
Visit [1Panel](https://www.bt.cn/new/download.html?r=dk_LangBot) and use the Linux panel installation script provided officially by 1Panel. Select the corresponding script according to your operating system.
|
||||
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
Copy the corresponding script, paste it into the server, and execute it.
|
||||
|
||||
@@ -36,23 +24,17 @@ Then copy the `External Address` and open it in a browser.
|
||||
|
||||
Open the `App Store`, select the `AI` category, and click to install LangBot.
|
||||
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
Check the box for `External Port Access` and click Confirm.
|
||||
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
Wait for a moment, and the installation will be completed.
|
||||
|
||||
Click `Containers` on the left side, then select the `Containers` category, and you will see the LangBot container bar.
|
||||
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
Copy the public IP address of the server, for example, `http://xxx.xxx.xxx.xxx:5300` (where xxx.xxx.xxx.xxx is the IP address of the server where 1Panel is located, and 5300 is the port number).
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
# aaPanel Deployment
|
||||
|
||||
Deploy LangBot with one click using [aaPanel](https://www.bt.cn/new/download.html?r=dk_LangBot).
|
||||
|
||||
:::warning
|
||||
- Unless you plan to use message platforms like Discord or Feishu that don't require additional containers, or you are familiar with Docker container networking on aaPanel, it's not recommended to use one-click deployment with aaPanel. Please consider using [Docker deployment](/en/deploy/langbot/docker).
|
||||
- If you already have aaPanel installed, please update to version **9.2.0** or higher
|
||||
:::
|
||||
|
||||
|
||||
## Installing aaPanel
|
||||
|
||||
> Recommended server systems (from aaPanel): Debian 12, Ubuntu 22, etc.
|
||||
>
|
||||
> This document assumes you have a server with a public IPv4 address. If you're using a home machine without a public IP, you can access the relevant pages through the internal network mentioned below.
|
||||
|
||||
Open [aaPanel](https://www.bt.cn/new/download.html?r=dk_LangBot), use the Linux panel installation script provided by aaPanel official, and select the corresponding script based on your system.
|
||||
|
||||

|
||||
|
||||
Copy the corresponding script and paste it into your server to execute.
|
||||
|
||||
## Installing LangBot
|
||||
|
||||
After waiting for a while, aaPanel installation will be complete.
|
||||
|
||||
You'll see a message similar to this, copy the external panel address and open it in your browser.
|
||||
|
||||

|
||||
|
||||
When you first open it, you should see a popup for `Recommended Installation Suite`. You can skip this by closing it.
|
||||
|
||||
Then click on `docker` in the sidebar. If it's your first time, you'll be prompted to install Docker and Docker Compose services. Click "Install Now" if prompted, or ignore if already installed.
|
||||
|
||||
Then go to `Docker -> App Store`, search for `LangBot` (note the case sensitivity), click `Install`, and use the default configuration.
|
||||
|
||||
After a short wait, you'll see a container named `langbot_XXXX` showing as `Running`.
|
||||
|
||||

|
||||
|
||||
Click the red circle in the image above to view the running logs.
|
||||
|
||||

|
||||
|
||||
You can see the external and internal access paths for the WebUI configuration page (visual configuration page). Copy the public address, for example `http://xxx.xxx.xxx.xxx:5300` (where xxx.xxx.xxx.xxx is your aaPanel IP, and 5300 is the port number, which may vary as shown in the image).
|
||||
|
||||
After opening it, enter your admin email and password, then click initialize.
|
||||
|
||||
You can then proceed with configuration in the visual interface.
|
||||
|
||||
If you prefer to directly modify JSON configuration files, you can look at the local mapping directory shown in the image above. Go to the installation directory, where the `data` folder is used to store configuration files, and the `plugins` folder is used for plugin-related files.
|
||||
|
||||
Next, please continue reading the [Deploy Message Platform](/en/deploy/platforms/readme) page.
|
||||
---
|
||||
title: "aaPanel Deployment"
|
||||
---
|
||||
|
||||
Deploy LangBot with one click using [aaPanel](https://www.bt.cn/new/download.html?r=dk_LangBot).
|
||||
|
||||
<Warning>
|
||||
If you already have aaPanel installed, please update to version **9.2.0** or higher
|
||||
</Warning>
|
||||
|
||||
## Installing aaPanel
|
||||
|
||||
> Recommended server systems (from aaPanel): Debian 12, Ubuntu 22, etc.
|
||||
>
|
||||
> This document assumes you have a server with a public IPv4 address. If you're using a home machine without a public IP, you can access the relevant pages through the internal network mentioned below.
|
||||
|
||||
Open [aaPanel](https://www.bt.cn/new/download.html?r=dk_LangBot), use the Linux panel installation script provided by aaPanel official, and select the corresponding script based on your system.
|
||||
|
||||

|
||||
|
||||
Copy the corresponding script and paste it into your server to execute.
|
||||
|
||||
## Installing LangBot
|
||||
|
||||
After waiting for a while, aaPanel installation will be complete.
|
||||
|
||||
You'll see a message similar to this, copy the external panel address and open it in your browser.
|
||||
|
||||

|
||||
|
||||
When you first open it, you should see a popup for `Recommended Installation Suite`. You can skip this by closing it.
|
||||
|
||||
Then click on `docker` in the sidebar. If it's your first time, you'll be prompted to install Docker and Docker Compose services. Click "Install Now" if prompted, or ignore if already installed.
|
||||
|
||||
Then go to `Docker -> App Store`, search for `LangBot` (note the case sensitivity), click `Install`, and use the default configuration.
|
||||
|
||||
After a short wait, you'll see a container named `langbot_XXXX` showing as `Running`.
|
||||
|
||||

|
||||
|
||||
Click the red circle in the image above to view the running logs.
|
||||
|
||||

|
||||
|
||||
You can see the external and internal access paths for the WebUI configuration page (visual configuration page). Copy the public address, for example `http://xxx.xxx.xxx.xxx:5300` (where xxx.xxx.xxx.xxx is your aaPanel IP, and 5300 is the port number, which may vary as shown in the image).
|
||||
|
||||
After opening it, enter your admin email and password, then click initialize.
|
||||
|
||||
You can then proceed with configuration in the visual interface.
|
||||
|
||||
If you prefer to directly modify JSON configuration files, you can look at the local mapping directory shown in the image above. Go to the installation directory, where the `data` folder is used to store configuration files, and the `plugins` folder is used for plugin-related files.
|
||||
|
||||
Next, please continue reading the [Deploy Message Platform](/en/deploy/platforms/readme) page.
|
||||
@@ -1,8 +1,10 @@
|
||||
# Deploy with Package Manager
|
||||
---
|
||||
title: "Deploy with Package Manager"
|
||||
---
|
||||
|
||||
:::info
|
||||
<Info>
|
||||
Supports Windows, Linux, Mac OS, etc. Recommended for testing environments and personal use scenarios; production-level environments please use [Docker Deployment](/en/deploy/langbot/docker.html).
|
||||
:::
|
||||
</Info>
|
||||
|
||||
LangBot is packaged and released to PyPI. Please install [uv](https://docs.astral.sh/uv/getting-started/installation/), and then run the following command in an empty directory:
|
||||
|
||||
@@ -10,4 +12,4 @@ LangBot is packaged and released to PyPI. Please install [uv](https://docs.astra
|
||||
uvx langbot@latest
|
||||
```
|
||||
|
||||
This will set the current directory as the working directory, and you can access `http://localhost:5300` to start using it.
|
||||
This will set the current directory as the working directory, and you can access `http://localhost:5300` to start using it.
|
||||
@@ -1,4 +1,6 @@
|
||||
# System Environment Settings
|
||||
---
|
||||
title: "System Environment Settings"
|
||||
---
|
||||
|
||||
Configure some environment information for system operation, located in the `data/config.yaml` file.
|
||||
Generally, no modification is needed.
|
||||
@@ -16,6 +18,10 @@ admins: []
|
||||
# API port
|
||||
api:
|
||||
port: 5300
|
||||
# LangBot centrally manages all bot addresses that require Webhook listening
|
||||
# This is the Webhook address prefix displayed on the bot page that requires Webhook connection
|
||||
# You can modify it according to your network environment
|
||||
webhook_prefix: 'http://127.0.0.1:5300'
|
||||
|
||||
# Command configuration
|
||||
command:
|
||||
@@ -99,6 +105,10 @@ system:
|
||||
expire: 604800
|
||||
# JWT secret key, a key will be automatically generated on first startup
|
||||
secret: 'xxxx'
|
||||
# Whether to allow changing the password
|
||||
allow_change_password: true
|
||||
# Recovery password key
|
||||
recovery_key: 'xxxx'
|
||||
|
||||
# Vector database configuration
|
||||
vdb:
|
||||
@@ -106,6 +116,9 @@ vdb:
|
||||
# Supported vector databases:
|
||||
# - chroma (default, embedded vector database)
|
||||
# - qdrant (external vector database, please configure below)
|
||||
# - milvus (scalable vector database, please configure below)
|
||||
# - pgvector (PostgreSQL extension, please configure below)
|
||||
# - seekdb (Built-in embedded-model database, please configure below)
|
||||
use: chroma
|
||||
# Qdrant configuration
|
||||
qdrant:
|
||||
@@ -117,6 +130,30 @@ vdb:
|
||||
port: 6333
|
||||
# Qdrant API Key
|
||||
api_key: ''
|
||||
# Milvus configuration
|
||||
milvus:
|
||||
uri: 'http://127.0.0.1:19530'
|
||||
token: ''
|
||||
# pgvector configuration
|
||||
pgvector:
|
||||
host: '127.0.0.1'
|
||||
port: 5433
|
||||
database: 'langbot'
|
||||
user: 'postgres'
|
||||
password: 'postgres'
|
||||
seekdb:
|
||||
# 'embedded' or 'server'
|
||||
mode: embedded
|
||||
# Embedded mode options:
|
||||
path: './data/seekdb'
|
||||
database: 'langbot'
|
||||
# Server mode options (used when mode='server'):
|
||||
host: 'localhost'
|
||||
port: 2881
|
||||
user: 'root'
|
||||
password: ''
|
||||
# Optional, for OceanBase server
|
||||
tenant: ''
|
||||
```
|
||||
|
||||
## Set configuration via environment variables
|
||||
@@ -132,4 +169,4 @@ The configuration in `config.yaml` can be set via environment variables. The env
|
||||
|
||||
...
|
||||
|
||||
When starting, LangBot will read all environment variables and apply the corresponding configuration to `config.yaml` and write to the `data/config.yaml` file.
|
||||
When starting, LangBot will read all environment variables and apply the corresponding configuration to `config.yaml` and write to the `data/config.yaml` file.
|
||||
@@ -1,4 +1,6 @@
|
||||
# Update LangBot
|
||||
---
|
||||
title: "Update LangBot"
|
||||
---
|
||||
|
||||
## Using Package Manager
|
||||
|
||||
@@ -26,9 +28,9 @@ docker compose up --force-recreate --pull always -d
|
||||
|
||||
This command will pull the latest LangBot image and rebuild the container.
|
||||
|
||||
:::info
|
||||
<Info>
|
||||
4.3.0 version changed the content and location of the `docker-compose.yaml` file, if you updated from a previous version, please [redploy according to the documentation](/en/deploy/langbot/docker).
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## Manual Deployment
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: "Component Architecture"
|
||||
---
|
||||
|
||||

|
||||
@@ -1,4 +1,6 @@
|
||||
# Development Configuration
|
||||
---
|
||||
title: "Development Configuration"
|
||||
---
|
||||
|
||||
LangBot is divided into frontend and backend. The frontend is developed using Next.js + shadcn, and the backend is developed using Quart (an asynchronous version of Flask).
|
||||
|
||||
@@ -52,11 +54,18 @@ npm run dev
|
||||
|
||||
Then according to the output information, visit `http://127.0.0.1:3000` to view the standalone frontend page.
|
||||
|
||||
:::info
|
||||
When using `pnpm dev` to start locally, the environment variable `NEXT_PUBLIC_API_BASE_URL` will be automatically used by the frontend to ensure that the frontend can access the `5300` port of the locally running backend.
|
||||
<Info title="When using `pnpm dev` to start locally, the environment variable `NEXT_PUBLIC_API_BASE_URL` will be automatically used by the frontend to ensure that the frontend can access the `5300` port of the locally running backend.">
|
||||
|
||||
In production environments, the frontend will be precompiled into static files and provided by the backend, and the frontend will automatically access the backend address on the same domain.
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## Code Formatting
|
||||
|
||||
The repository contains lint and format check workflows, and your code will be automatically checked when you push it. Please configure pre-commit to check your code locally before submitting.
|
||||
|
||||
```bash
|
||||
uv run pre-commit install
|
||||
```
|
||||
|
||||
## API Documentation
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Debugging Plugin Runtime, CLI, SDK
|
||||
---
|
||||
title: "Debugging Plugin Runtime, CLI, SDK"
|
||||
---
|
||||
|
||||
::: info
|
||||
Please read the [Plugin Tutorial](/en/plugin/plugin-intro) first to understand the plugin system.
|
||||
|
||||
- Plugin Runtime, CLI, SDK are open sourced at: https://github.com/langbot-app/langbot-plugin-sdk
|
||||
:::
|
||||
<Info>
|
||||
Plugin Runtime, CLI, SDK are open sourced at: https://github.com/langbot-app/langbot-plugin-sdk
|
||||
</Info>
|
||||
|
||||
Clone the plugin runtime source code:
|
||||
|
||||
@@ -52,7 +52,7 @@ plugin:
|
||||
runtime_ws_url: ws://localhost:5400/control/ws
|
||||
```
|
||||
|
||||
And add the startup parameter `--standalone-runtime` when starting the LangBot main program (e.g., `uv run main.py --standalone-runtime`).
|
||||
And add the startup parameter `--standalone-runtime` when starting the LangBot main program (e.g., `uv run main.py --standalone-runtime`).\
|
||||
Restart LangBot, and it will connect to this runtime using WebSocket.
|
||||
|
||||
## langbot-plugin-sdk Architecture
|
||||
@@ -1,4 +1,6 @@
|
||||
# Community Resources
|
||||
---
|
||||
title: "Community Resources"
|
||||
---
|
||||
|
||||
|
||||
## Simplified Tutorials
|
||||
@@ -8,4 +10,4 @@ Collected at: https://blog.thelazy.top/tags/langbot
|
||||
|
||||
## 🥰 Community
|
||||
|
||||
Join our community on Discord: [](https://discord.gg/wdNEHETs87)
|
||||
Join our community on Discord: [](https://discord.gg/wdNEHETs87)
|
||||
@@ -1,4 +1,6 @@
|
||||
# Features
|
||||
---
|
||||
title: "Features"
|
||||
---
|
||||
|
||||
LangBot is an open-source LLM native instant messaging robot development platform, aiming to provide an out-of-the-box IM robot development experience, with Agent, RAG, MCP and other LLM application functions, supporting global instant messaging platforms, and providing rich API interfaces, supporting custom development.
|
||||
|
||||
@@ -6,21 +8,25 @@ LangBot is an open-source LLM native instant messaging robot development platfor
|
||||
|
||||
| Platform | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Personal QQ | ✅ | |
|
||||
| QQ Official API | ✅ | |
|
||||
| Personal QQ | ✅ | Supported by third-party applications that implement the OneBot11 protocol, supports QQ personal private and group chats |
|
||||
| QQ Official Bot | ✅ | QQ Official Bot, supports channels, private chats, and group chats |
|
||||
| WeCom | ✅ | |
|
||||
| WeComCS | ✅ | |
|
||||
| WeComIntelligentBot | ✅ | Support streaming output |
|
||||
| WeCom Intelligent Bot | ✅ | Support streaming output |
|
||||
| WeCom Customer Service | ✅ | |
|
||||
| WeChat Official Account | ✅ | |
|
||||
| Lark | ✅ | Support streaming output |
|
||||
| DingTalk | ✅ | Support streaming output |
|
||||
| Discord | ✅ | |
|
||||
| Telegram | ✅ | Support streaming output |
|
||||
| Slack | ✅ | |
|
||||
| LINE | ✅ | |
|
||||
| KOOK | ✅ | |
|
||||
| WhatsApp | 🚧 | |
|
||||
|
||||
🚧: In development
|
||||
|
||||
For platform-specific feature support, please check [this document](/en/insight/platform-features).
|
||||
|
||||
## Model and LLMOps Platform Support
|
||||
|
||||
| Provider/Service | Status | Remarks |
|
||||
@@ -31,22 +37,23 @@ LangBot is an open-source LLM native instant messaging robot development platfor
|
||||
| [Anthropic](https://www.anthropic.com/) | ✅ | |
|
||||
| [xAI](https://x.ai/) | ✅ | |
|
||||
| [Zhipu AI](https://open.bigmodel.cn/) | ✅ | |
|
||||
| [ShengSuanYun](https://www.shengsuanyun.com/?from=CH_KYIPP758) | ✅ | Global LLM aggregation platform (Recommended) |
|
||||
| [CompShare](https://www.compshare.cn/?ytag=GPU_YY-gh_langbot) | ✅ | LLM and GPU resource platform |
|
||||
| [PPIO](https://ppio.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) | ✅ | LLM and GPU resource platform |
|
||||
| [302.AI](https://share.302.ai/SuTG99) | ✅ | LLM gateway (MaaS) |
|
||||
| [Google Gemini](https://aistudio.google.com/prompts/new_chat) | ✅ | |
|
||||
| [Dify](https://dify.ai) | ✅ | LLMOps platform |
|
||||
| [n8n](https://n8n.io/) | ✅ | LLMOps platform |
|
||||
| [Langflow](https://langflow.org/) | ✅ | LLMOps platform |
|
||||
| [PPIO](https://ppio.com/user/register?invited_by=QJKFYD&utm_source=github_langbot) | ✅ | LLM and GPU resource platform |
|
||||
| [ShengSuanYun](https://www.shengsuanyun.com/login?code=7DS2QLH5) | ✅ | LLM and GPU resource platform |
|
||||
| [302.AI](https://share.302.ai/SuTG99) | ✅ | LLM gateway(MaaS) |
|
||||
| [Google Gemini](https://aistudio.google.com/prompts/new_chat) | ✅ | |
|
||||
| [Ollama](https://ollama.com/) | ✅ | Local LLM running platform |
|
||||
| [LMStudio](https://lmstudio.ai/) | ✅ | Local LLM running platform |
|
||||
| [GiteeAI](https://ai.gitee.com/) | ✅ | LLM interface gateway(MaaS) |
|
||||
| [SiliconFlow](https://siliconflow.cn/) | ✅ | LLM gateway(MaaS) |
|
||||
| [Aliyun Bailian](https://bailian.console.aliyun.com/) | ✅ | LLM gateway(MaaS), LLMOps platform |
|
||||
| [Volc Engine Ark](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | LLM gateway(MaaS), LLMOps platform |
|
||||
| [ModelScope](https://modelscope.cn/docs/model-service/API-Inference/intro) | ✅ | LLM gateway(MaaS) |
|
||||
| [Coze](https://coze.com) | ✅ | LLMOps platform |
|
||||
| [GiteeAI](https://ai.gitee.com/) | ✅ | LLM interface gateway (MaaS) |
|
||||
| [SiliconFlow](https://siliconflow.cn/) | ✅ | LLM gateway (MaaS) |
|
||||
| [Aliyun Bailian](https://bailian.console.aliyun.com/) | ✅ | LLM gateway (MaaS), LLMOps platform |
|
||||
| [Volc Engine Ark](https://console.volcengine.com/ark/region:ark+cn-beijing/model?vendor=Bytedance&view=LIST_VIEW) | ✅ | LLM gateway (MaaS), LLMOps platform |
|
||||
| [ModelScope](https://modelscope.cn/docs/model-service/API-Inference/intro) | ✅ | LLM gateway (MaaS) |
|
||||
| [TBox (Ant TreasureBox)](https://tbox.cn/) | ✅ | LLMOps platform |
|
||||
| [Coze](https://coze.cn) | ✅ | LLMOps platform |
|
||||
|
||||
## LLM Application Paradigm Implementation
|
||||
|
||||
@@ -56,16 +63,22 @@ LangBot is an open-source LLM native instant messaging robot development platfor
|
||||
| RAG | ✅ | Using Chroma as vector database |
|
||||
| MCP | ✅ | Support Stdio and HTTP protocol |
|
||||
|
||||
## System Extensibility
|
||||
|
||||
- HTTP Service API: Supports accessing various entities of LangBot through HTTP API interfaces with API key authentication.
|
||||
- Outgoing Webhook: Supports sending internal events of LangBot to external systems through Webhook.
|
||||
- Production-grade plugin system: A production-grade plugin system based on cross-process communication technology and asynchronous technology, supporting various component extensions.
|
||||
|
||||
## Case Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
@@ -1,4 +1,6 @@
|
||||
# Welcome to LangBot Documentation
|
||||
---
|
||||
title: "Welcome to LangBot Documentation"
|
||||
---
|
||||
|
||||
LangBot is an open-source Large Language Model (LLM) native instant messaging bot platform that supports multiple messaging platforms and model providers. It provides support for LLMOps platforms such as Dify. It also offers a WebUI for users to quickly deploy and use.
|
||||
|
||||
@@ -34,6 +36,6 @@ Check [Configure Bots](/en/deploy/platforms/readme) in the left sidebar
|
||||
|
||||
Check [Configure Dialogue Models](/en/deploy/models/readme) in the left sidebar
|
||||
|
||||
<br>
|
||||
<br />
|
||||
|
||||
After completing the above two steps, you can start using LangBot. If you need to configure more features, you can set them in the [Pipeline](/en/deploy/pipelines/readme) section
|
||||
@@ -0,0 +1,231 @@
|
||||
---
|
||||
title: "Platform Feature Support"
|
||||
---
|
||||
|
||||
The following is a list of features we have implemented and tested for each platform. If you encounter unexpected behavior, please feel free to report it to [GitHub Issues](https://github.com/langbot-app/LangBot/issues) or directly submit a Pull Request to help fix it.
|
||||
|
||||
## OneBot v11
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ✅ | |
|
||||
| Receive group regular messages | ✅ | |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ✅ | |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ✅ | Text and image combined |
|
||||
| Get private message event user name | ✅ | |
|
||||
| Get group message event group name | ✅ | |
|
||||
| Get group message event sender name | ✅ | |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ✅ | |
|
||||
| Reply with image messages | ✅ | |
|
||||
| Reply with voice messages | ✅ | |
|
||||
| Reply with file messages | ✅ | |
|
||||
| Reply with rich text messages | ✅ | Text and image combined |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ❌ | |
|
||||
|
||||
## QQ Official Bot
|
||||
|
||||
## WeCom (Internal Application)
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ❌ | WeCom internal application does not support adding to groups |
|
||||
| Receive group regular messages | ❌ | |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ✅ | |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ❌ | |
|
||||
| Get private message event user name | ✅ | |
|
||||
| Get group message event group name | ❌ | |
|
||||
| Get group message event sender name | ❌ | |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ❌ | |
|
||||
| Reply with image messages | ✅ | |
|
||||
| Reply with voice messages | ✅ | |
|
||||
| Reply with file messages | ✅ | |
|
||||
| Reply with rich text messages | ❌ | |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ❌ | |
|
||||
|
||||
## WeCom (Customer Service)
|
||||
|
||||
## WeCom Intelligent Bot
|
||||
|
||||
## WeChat Official Account
|
||||
|
||||
## Lark
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ✅ | |
|
||||
| Receive group regular messages | ❌ | Lark only supports receiving messages that mention the bot |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ❌ | Lark does not have voice messages |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ✅ | Text and image combined |
|
||||
| Get private message event user name | ❌ | Lark does not support getting user name |
|
||||
| Get group message event group name | ❌ | Lark does not support getting group name |
|
||||
| Get group message event sender name | ❌ | Lark does not support getting sender name |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ✅ | |
|
||||
| Reply with image messages | ✅ | |
|
||||
| Reply with voice messages | ❌ | |
|
||||
| Reply with file messages | ❌ | |
|
||||
| Reply with rich text messages | ❌ | |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ✅ | |
|
||||
|
||||
## DingTalk
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ✅ | |
|
||||
| Receive group regular messages | ❌ | DingTalk only supports receiving messages that mention the bot |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ✅ | |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ✅ | Text and image combined |
|
||||
| Get private message event user name | ✅ | |
|
||||
| Get group message event group name | ✅ | |
|
||||
| Get group message event sender name | ✅ | |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ✅ | |
|
||||
| Reply with image messages | ✅ | |
|
||||
| Reply with voice messages | ❌ | |
|
||||
| Reply with file messages | ❌ | |
|
||||
| Reply with rich text messages | ✅ | Text and image combined |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ✅ | |
|
||||
|
||||
## KOOK
|
||||
|
||||
P.S. Sending voice and file messages has errors not fixed yet
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ✅ | |
|
||||
| Receive group regular messages | ✅ | |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ✅ | |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ✅ | Text and image combined |
|
||||
| Get private message event user name | ✅ | |
|
||||
| Get group message event group name | ✅ | |
|
||||
| Get group message event sender name | ✅ | |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ✅ | |
|
||||
| Reply with image messages | ✅ | |
|
||||
| Reply with voice messages | ❌ | KOOK does not support replying with voice messages |
|
||||
| Reply with file messages | ❌ | |
|
||||
| Reply with rich text messages | ✅ | Text and image combined |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ❌ | |
|
||||
|
||||
## Discord
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ✅ | |
|
||||
| Receive group regular messages | ✅ | |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ❌ | |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ✅ | Text and image combined |
|
||||
| Get private message event user name | ✅ | |
|
||||
| Get group message event group name | ✅ | |
|
||||
| Get group message event sender name | ✅ | |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ✅ | |
|
||||
| Reply with image messages | ✅ | Sent as file attachment |
|
||||
| Reply with voice messages | ✅ | Sent as file attachment |
|
||||
| Reply with file messages | ✅ | |
|
||||
| Reply with rich text messages | ✅ | Text and file combined |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ❌ | |
|
||||
|
||||
## Telegram
|
||||
|
||||
P.S. Not tested
|
||||
|
||||
### Receive
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Receive private messages | ✅ | |
|
||||
| Receive group mention messages | ✅ | |
|
||||
| Receive group regular messages | ✅ | |
|
||||
| Receive image messages | ✅ | |
|
||||
| Receive voice messages | ❌ | |
|
||||
| Receive file messages | ✅ | |
|
||||
| Receive rich text messages | ✅ | |
|
||||
| Get private message event user name | ✅ | |
|
||||
| Get group message event group name | ✅ | |
|
||||
| Get group message event sender name | ✅ | |
|
||||
|
||||
### Send
|
||||
|
||||
| Feature | Status | Remarks |
|
||||
| --- | --- | --- |
|
||||
| Reply to private messages | ✅ | |
|
||||
| Reply to group messages | ✅ | |
|
||||
| Reply with image messages | ✅ | |
|
||||
| Reply with voice messages | ✅ | |
|
||||
| Reply with file messages | ✅ | |
|
||||
| Reply with rich text messages | ✅ | |
|
||||
| Send proactive messages | ✅ | |
|
||||
| Send streaming response | ❌ | |
|
||||
|
||||
## Slack
|
||||
|
||||
## LINE
|
||||
@@ -1,4 +1,6 @@
|
||||
# System Compatibility
|
||||
---
|
||||
title: "System Compatibility"
|
||||
---
|
||||
|
||||
LangBot's plugin system utilizes mechanisms such as `Asyncio` and `Subprocess`, which work well on Unix-like systems (such as Linux, macOS), but have some issues on Windows, preventing plugins from running properly.
|
||||
|
||||
@@ -12,4 +14,4 @@ For detailed information about these issues, please refer to: [Python Official D
|
||||
|
||||
Unlike the tight coupling between subprocess management and Stdio communication on Unix-like systems, LangBot and the Plugin Runtime automatically switch to a hybrid subprocess + WebSocket communication strategy on Windows. LangBot still launches the Plugin Runtime via a subprocess, but communicates with it over WebSocket; similarly, the Plugin Runtime starts each installed plugin via subprocesses while communicating with them through WebSocket.
|
||||
|
||||
This behavior is automatically selected based on the OS, so no manual configuration is required.
|
||||
This behavior is automatically selected based on the OS, so no manual configuration is required.
|
||||
@@ -1,11 +1,9 @@
|
||||
# Plugin Common APIs
|
||||
---
|
||||
title: "Plugin Common APIs"
|
||||
---
|
||||
|
||||
LangBot provides a series of APIs for plugins to operate various LangBot modules and control message contexts.
|
||||
|
||||
:::info Table of Contents
|
||||
[[toc]]
|
||||
:::
|
||||
|
||||
## Request API
|
||||
|
||||
Operations for the currently processing user request (message). Only available in `EventListener` and `Command` components. Access methods:
|
||||
@@ -309,4 +307,4 @@ async def get_config_file(self, file_key: str) -> bytes:
|
||||
file_bytes = await self.plugin.get_config_file("key")
|
||||
```
|
||||
|
||||
Use this in conjunction with configuration fields of type [`file` or `array[file`](/en/plugin/dev/basic-info.html#type-file).
|
||||
Use this in conjunction with configuration fields of type [``file or array[file``](/en/plugin/dev/basic-info.html#type-file).
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
title: "Message Platform Entities"
|
||||
---
|
||||
|
||||
LangBot supports multiple messaging platforms, and each platform has different `message entity` formats. To abstract away these differences, we have implemented a unified standard. Plugin developers only need to master and use the message entities described on this page in plugins, and LangBot's internal message processing logic can automatically handle message parsing and conversion.
|
||||
|
||||
## Message Chain
|
||||
|
||||
`Messages` on messaging platforms are different from messages used for AI interaction. Messages on messaging platforms are described in the form of `message chains`. Each independent message displayed on QQ is a message chain, which can contain various `message chain components` such as `text`, `images`, `@mentions`, etc. For example:
|
||||
|
||||

|
||||
|
||||
This is a message chain containing one Plain component (Hello World) and one Image component (Usagi).
|
||||
|
||||
The definitions of message chains and message chain components are located in `langbot_plugin.api.entities.builtin.platform.message`.
|
||||
|
||||
### Constructing Message Chains
|
||||
|
||||
Please first import the `langbot_plugin.api.entities.builtin.platform.message` package to use the message components within it.
|
||||
|
||||
```python
|
||||
from langbot_plugin.api.entities.builtin.platform.message import *
|
||||
|
||||
# Build a message containing text "Hello LangBot" and an image (from URL)
|
||||
msg_chain = MessageChain([
|
||||
Plain(text="Hello LangBot"),
|
||||
Image(url='https://qchatgpt.rockchin.top/langbot-logo.png')
|
||||
])
|
||||
|
||||
# Build a message containing @everyone and text "Hello LangBot"
|
||||
msg_chain = MessageChain([
|
||||
AtAll(),
|
||||
Plain(text="Hello LangBot")
|
||||
])
|
||||
|
||||
# Build a message containing @specific member and text "Hello LangBot"
|
||||
msg_chain = MessageChain([
|
||||
At(target=123456),
|
||||
Plain(text="Hello LangBot")
|
||||
])
|
||||
```
|
||||
|
||||
Currently supported message chain components:
|
||||
|
||||
- `Source` - Source message chain information. Messages received from messaging platforms will include this component at the front of the message chain to record message information
|
||||
- `Plain` - Plain text message
|
||||
- `Quote` - Quote message
|
||||
- `Image` - Image message
|
||||
- `AtAll` - @everyone message
|
||||
- `At` - @specific member message
|
||||
- `Voice` - Voice message
|
||||
- Need to check messaging platform support
|
||||
- `Forward` - Forward message
|
||||
- Not supported on many platforms, not recommended
|
||||
- `File` - File message
|
||||
|
||||
When creating components, named parameters must be used. For specific usage, you can check the definitions in the source code `langbot_plugin.api.entities.builtin.platform.message`.
|
||||
|
||||
## Other Entities
|
||||
|
||||
In addition to the above entities, there are also entities like `Friend` and `Group`. These entities are defined in `langbot_plugin.api.entities.platform.entities`.
|
||||
|
||||
## Accessing Underlying Platform APIs
|
||||
|
||||
<Warning>
|
||||
Not applicable for 4.x.
|
||||
</Warning>
|
||||
|
||||
To abstract away platform differences, LangBot provides an abstraction layer above messaging platform APIs, which includes the content described above and various platform adapters in the `pkg/platform/sources` directory. However, due to significant platform differences, the entity and API encapsulation in the abstraction layer is not complete. If your plugin needs to access platform-specific functionality, you can access underlying APIs according to the following instructions.
|
||||
|
||||
<Info>
|
||||
```python
|
||||
# For example in a plugin
|
||||
@handler(GroupMessageReceived)
|
||||
async def _(self, ctx: EventContext):
|
||||
# Get adapter object
|
||||
adapter = ctx.query.adapter
|
||||
```
|
||||
</Info>
|
||||
|
||||
| Platform | Adapter | Access Method | Description |
|
||||
| ------------------------- | --------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| OneBot v11 | aiocqhttp | adapter.bot | bot object corresponds to [aiocqhttp](https://github.com/nonebot/aiocqhttp) CQHttp object, please refer to aiocqhttp documentation for detailed usage |
|
||||
| QQ Official API | qqofficial | adapter.bot | bot object is the SDK object under libs/qq_official_api, for detailed usage please refer to the `send_group_text_msg` method in `QQOfficialClient` in libs/qq_official_api/api.py for HTTP request methods, please refer to QQ Official API documentation for specific interface documentation |
|
||||
| WeCom (Enterprise WeChat) | wecom | adapter.bot | Refer to the `send_image` method in `WecomClient` in libs/wecom_api/api.py for HTTP request methods, please refer to WeCom API documentation for specific interface documentation |
|
||||
| WeChat Official Account | officialaccount | - | Please refer to WeChat Official Account API documentation for interface documentation, credential information can be obtained from adapter.bot |
|
||||
| Lark | lark | adapter.api_client | Lark SDK's API Client object, please refer to [oapi-sdk-python](https://github.com/larksuite/oapi-sdk-python) for details |
|
||||
| DingTalk | dingtalk | - | Please refer to DingTalk API documentation, credential information can be obtained from adapter.bot |
|
||||
| Discord | discord | adapter.bot | bot object is [Rapptz/discord.py](https://github.com/Rapptz/discord.py) Discord object, please refer to documentation for detailed usage |
|
||||
| Telegram | telegram | adapter.bot | bot object is [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) Telegram object, please refer to documentation for detailed usage |
|
||||
| Slack | slack | adapter.bot | bot object in libs/slack_api/api.py, please refer to its code and Slack SDK for detailed usage |
|
||||
@@ -1,8 +1,6 @@
|
||||
# Pipeline Events and APIs
|
||||
|
||||
:::info Table of Contents
|
||||
[[toc]]
|
||||
:::
|
||||
---
|
||||
title: "Pipeline Events and APIs"
|
||||
---
|
||||
|
||||
LangBot plugins can register and handle pipeline events. For usage instructions, see [Component: Event Listener](/en/plugin/dev/components/event-listener).
|
||||
|
||||
@@ -10,7 +8,7 @@ LangBot plugins can register and handle pipeline events. For usage instructions,
|
||||
|
||||
Some events have `settable attributes`, which can be modified by plugin code and used in subsequent LangBot processing.
|
||||
|
||||
### *MessageReceived
|
||||
### \*MessageReceived
|
||||
|
||||
Triggered when any message is received in group chat or private chat.
|
||||
|
||||
@@ -27,12 +25,16 @@ class PersonMessageReceived(BaseEventModel):
|
||||
"""Sender ID"""
|
||||
|
||||
sender_id: typing.Union[int, str]
|
||||
"""Sender ID"""
|
||||
"""Sender ID, same as launcher_id in private chat"""
|
||||
|
||||
message_event: platform_events.PersonMessage
|
||||
"""Original message event object. Contains sender information."""
|
||||
|
||||
message_chain: platform_message.MessageChain = pydantic.Field(
|
||||
serialization_alias="message_chain"
|
||||
)
|
||||
"""Raw message chain"""
|
||||
"""Message chain"""
|
||||
|
||||
|
||||
class GroupMessageReceived(BaseEventModel):
|
||||
"""When any group chat message is received"""
|
||||
@@ -48,13 +50,16 @@ class GroupMessageReceived(BaseEventModel):
|
||||
sender_id: typing.Union[int, str]
|
||||
"""Sender ID"""
|
||||
|
||||
message_event: platform_events.GroupMessage
|
||||
"""Original message event object. Contains group and sender information."""
|
||||
|
||||
message_chain: platform_message.MessageChain = pydantic.Field(
|
||||
serialization_alias="message_chain"
|
||||
)
|
||||
"""Raw message chain"""
|
||||
"""Message chain"""
|
||||
```
|
||||
|
||||
### *NormalMessageReceived
|
||||
### \*NormalMessageReceived
|
||||
|
||||
Triggered when a group chat or private chat message is received and determined to be a message that needs to be processed by LLM (non-command message).
|
||||
|
||||
@@ -65,18 +70,24 @@ class PersonNormalMessageReceived(BaseEventModel):
|
||||
event_name: str = "PersonNormalMessageReceived"
|
||||
|
||||
launcher_type: str
|
||||
"""Launcher object type (person)"""
|
||||
|
||||
launcher_id: typing.Union[int, str]
|
||||
"""Launcher object ID"""
|
||||
|
||||
sender_id: typing.Union[int, str]
|
||||
"""Sender ID, same as launcher_id in private chat"""
|
||||
|
||||
text_message: str
|
||||
"""Message text"""
|
||||
|
||||
message_event: platform_events.PersonMessage
|
||||
"""Original message event object. Contains sender information."""
|
||||
|
||||
message_chain: platform_message.MessageChain = pydantic.Field(
|
||||
serialization_alias="message_chain"
|
||||
)
|
||||
"""Raw message chain"""
|
||||
"""Message chain"""
|
||||
|
||||
# ========== Settable Attributes ==========
|
||||
|
||||
@@ -84,7 +95,8 @@ class PersonNormalMessageReceived(BaseEventModel):
|
||||
"""Modified message text, langbot_plugin.api.entities.builtin.provider.message.ContentElement type"""
|
||||
|
||||
reply_message_chain: typing.Optional[platform_message.MessageChain] = None
|
||||
"""Reply message component list, only effective when preventing default behavior"""
|
||||
"""Direct reply message chain, only effective when preventing default behavior"""
|
||||
|
||||
|
||||
class GroupNormalMessageReceived(BaseEventModel):
|
||||
"""Triggered when a group chat normal message that should be processed is determined"""
|
||||
@@ -92,18 +104,24 @@ class GroupNormalMessageReceived(BaseEventModel):
|
||||
event_name: str = "GroupNormalMessageReceived"
|
||||
|
||||
launcher_type: str
|
||||
"""Launcher object type (group)"""
|
||||
|
||||
launcher_id: typing.Union[int, str]
|
||||
"""Group ID"""
|
||||
|
||||
sender_id: typing.Union[int, str]
|
||||
"""Sender ID"""
|
||||
|
||||
text_message: str
|
||||
"""Message text"""
|
||||
|
||||
message_event: platform_events.GroupMessage
|
||||
"""Original message event object. Contains group and sender information."""
|
||||
|
||||
message_chain: platform_message.MessageChain = pydantic.Field(
|
||||
serialization_alias="message_chain"
|
||||
)
|
||||
"""Raw message chain"""
|
||||
"""Message chain"""
|
||||
|
||||
# ========== Settable Attributes ==========
|
||||
|
||||
@@ -111,14 +129,14 @@ class GroupNormalMessageReceived(BaseEventModel):
|
||||
"""Modified message text, langbot_plugin.api.entities.builtin.provider.message.ContentElement type"""
|
||||
|
||||
reply_message_chain: typing.Optional[platform_message.MessageChain] = None
|
||||
"""Reply message component list, only effective when preventing default behavior"""
|
||||
"""Direct reply message chain, only effective when preventing default behavior"""
|
||||
```
|
||||
|
||||
### *CommandSent
|
||||
### \*CommandSent
|
||||
|
||||
:::warning Note
|
||||
No longer recommended for use, please use [Component: Command](/en/plugin/dev/components/command) instead.
|
||||
:::
|
||||
<Warning>
|
||||
No longer recommended for use, please use [Component: Command](/en/plugin/dev/components/command) instead.
|
||||
</Warning>
|
||||
|
||||
Triggered when a group chat or private chat command is received.
|
||||
|
||||
@@ -169,7 +187,6 @@ class GroupCommandSent(BaseEventModel):
|
||||
|
||||
is_admin: bool
|
||||
"""Whether it's an administrator"""
|
||||
|
||||
```
|
||||
|
||||
### NormalMessageResponded
|
||||
@@ -220,11 +237,12 @@ class PromptPreProcessing(BaseEventModel):
|
||||
event_name: str = "PromptPreProcessing"
|
||||
|
||||
session_name: str
|
||||
"""Session name, format is person_1234567890 or group_1234567890"""
|
||||
|
||||
# ========== Settable Attributes ==========
|
||||
|
||||
default_prompt: list[typing.Union[provider_message.Message, provider_message.MessageChunk]]
|
||||
"""Scenario preset for this conversation, can be modified, langbot_plugin.api.entities.builtin.provider.message.Message or langbot_plugin.api.entities.builtin.provider.message.MessageChunk type"""
|
||||
"""Scenario preset (system prompt) for this conversation, can be modified, langbot_plugin.api.entities.builtin.provider.message.Message or langbot_plugin.api.entities.builtin.provider.message.MessageChunk type"""
|
||||
|
||||
prompt: list[typing.Union[provider_message.Message, provider_message.MessageChunk]]
|
||||
"""Existing message records for this conversation, can be modified, langbot_plugin.api.entities.builtin.provider.message.Message or langbot_plugin.api.entities.builtin.provider.message.MessageChunk type"""
|
||||
@@ -241,6 +259,20 @@ class PromptPreProcessing(BaseEventModel):
|
||||
|
||||
Event processing methods will be passed the `EventContext` object, which contains event context information, and the object has both [Request API](/en/plugin/dev/apis/common) and event context specific APIs. The following is a list of event context specific APIs:
|
||||
|
||||
### Get Original Event Attributes
|
||||
|
||||
`event_context.event` attribute is the original event object, which can get the attributes of the original event. The type is the type of the event being listened to.
|
||||
|
||||
For example, when the event being listened to is `GroupMessageReceived`:
|
||||
|
||||
```python
|
||||
event = event_context.event
|
||||
print(event.launcher_type) # Launcher object type (group)
|
||||
print(event.launcher_id) # Group ID
|
||||
print(event.sender_id) # Sender account ID
|
||||
print(event.message_chain) # Message chain
|
||||
```
|
||||
|
||||
### Prevent Default Behavior
|
||||
|
||||
```python
|
||||
@@ -253,18 +285,15 @@ event_context.prevent_default()
|
||||
|
||||
Calling this method will prevent the default subsequent behavior of this event, and the pipeline will end directly.
|
||||
|
||||
:::info
|
||||
Only the following events can prevent default behavior:
|
||||
|
||||
- PersonMessageReceived
|
||||
- GroupMessageReceived
|
||||
- PersonNormalMessageReceived
|
||||
- GroupNormalMessageReceived
|
||||
- PersonCommandSent
|
||||
- GroupCommandSent
|
||||
- NormalMessageResponded
|
||||
|
||||
:::
|
||||
<Info>
|
||||
- PersonMessageReceived
|
||||
- GroupMessageReceived
|
||||
- PersonNormalMessageReceived
|
||||
- GroupNormalMessageReceived
|
||||
- PersonCommandSent
|
||||
- GroupCommandSent
|
||||
- NormalMessageResponded
|
||||
</Info>
|
||||
|
||||
### Prevent Postorder Execution
|
||||
|
||||
@@ -276,4 +305,4 @@ def prevent_postorder(self):
|
||||
event_context.prevent_postorder()
|
||||
```
|
||||
|
||||
Calling this method will prevent the subsequent plugins from executing this time.
|
||||
Calling this method will prevent the subsequent plugins from executing this time.
|
||||
@@ -1,11 +1,13 @@
|
||||
# Plugin Technical Details
|
||||
---
|
||||
title: "Plugin Technical Details"
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/plugin_system_arch.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/plugin_system_arch.png" />
|
||||
|
||||
In version 4.0, we introduced a high-security, high-flexibility production-grade plugin system and provided developers with rich APIs and easy-to-use supporting tools.
|
||||
|
||||
Plugin Runtime is used to manage plugin lifecycles and coordinate interactions between LangBot and plugins. It has two operating modes: `stdio` and `websocket`. When LangBot is started directly by users (not running in a container), it uses `stdio` mode, which is common for personal users or lightweight environments. When LangBot runs in a container, it uses `websocket` mode, designed specifically for production environments.
|
||||
|
||||
Plugin Runtime automatically starts each installed plugin and interacts through stdio. In plugin development scenarios, developers can use the `lbp` command-line tool to start plugins and connect to the running Runtime via WebSocket for debugging.
|
||||
Plugin Runtime automatically starts each installed plugin and interacts through stdio. In plugin development scenarios, developers can use the `lbp` command-line tool to start plugins and connect to the running Runtime via WebSocket for debugging.
|
||||
@@ -1,8 +1,6 @@
|
||||
# Completing Plugin Configuration Information
|
||||
|
||||
:::info Table of Contents
|
||||
[[toc]]
|
||||
:::
|
||||
---
|
||||
title: "Completing Plugin Configuration Information"
|
||||
---
|
||||
|
||||
## Modifying the Manifest File
|
||||
|
||||
@@ -180,9 +178,9 @@ print(file_config)
|
||||
file_bytes = await self.get_config_file(file_key)
|
||||
```
|
||||
|
||||
::: info
|
||||
Common MIME type and file extension reference: [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)
|
||||
:::
|
||||
<Info>
|
||||
Common MIME type and file extension reference: [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types)
|
||||
</Info>
|
||||
|
||||
### type: array[file]
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
# Adding Components
|
||||
---
|
||||
title: "Adding Components"
|
||||
---
|
||||
|
||||
Plugins consist of one or more components that provide different functionalities to LangBot. Currently supported component types include:
|
||||
|
||||
- Event Listeners (EventListener): Listen to events during pipeline execution and modify context or pipelines.
|
||||
- Commands (Command): Triggered by user command messages starting with `!` (or other configured prefixes).
|
||||
- Tools (Tool): Called by LLMs during execution of LangBot's built-in Local Agent.
|
||||
- Knowledge Retrievers (KnowledgeRetriever): Provide external knowledge base retrieval capabilities for LangBot, supporting integration with various RAG systems.
|
||||
|
||||
## Adding Components
|
||||
|
||||
@@ -30,8 +33,7 @@ Component EventListener generated successfully.
|
||||
➜ HelloPlugin >
|
||||
```
|
||||
|
||||
:::info
|
||||
The CLI will generate a `components` directory in the plugin directory and create corresponding component directories within it.
|
||||
<Info title="The CLI will generate a `components` directory in the plugin directory and create corresponding component directories within it.">
|
||||
|
||||
```
|
||||
.
|
||||
@@ -60,12 +62,13 @@ components:
|
||||
...
|
||||
```
|
||||
To remove components, you can delete the corresponding information manually.
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## Component Types
|
||||
|
||||
For detailed usage of each component, please refer to:
|
||||
|
||||
- [EventListener](./event-listener.md)
|
||||
- [Command](./command.md)
|
||||
- [Tool](./tool.md)
|
||||
- [EventListener](./event-listener)
|
||||
- [Command](./command)
|
||||
- [Tool](./tool)
|
||||
- [KnowledgeRetriever](./knowledge-retriever)
|
||||
@@ -1,8 +1,10 @@
|
||||
# Component: Command
|
||||
---
|
||||
title: "Component: Command"
|
||||
---
|
||||
|
||||
Command components are triggered by user command messages starting with `!` (or other configured prefixes). Here's an example of triggering the `!help` command:
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/components/command_use.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/components/command_use.png" />
|
||||
|
||||
## Adding Command Components
|
||||
|
||||
@@ -53,7 +55,7 @@ execution:
|
||||
|
||||
## Plugin Processing
|
||||
|
||||
The following code is generated by default (components/command/<command_name>.py). You need to register and implement subcommand processing logic in the `initialize` method of the `Info` class.
|
||||
The following code is generated by default (`components/command/<command_name>.py`). You need to register and implement subcommand processing logic in the `initialize` method of the `Info` class.
|
||||
|
||||
```python
|
||||
# Auto generated by LangBot Plugin SDK.
|
||||
@@ -136,7 +138,7 @@ In subcommand functions, you can read command parameters through the `context` v
|
||||
|
||||
The effect of the above command is shown in the image:
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/components/info_command_demo.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/components/info_command_demo.png" />
|
||||
|
||||
### Command Context
|
||||
|
||||
@@ -209,4 +211,4 @@ For specific return values, please refer to the definition of `CommandReturn`: [
|
||||
|
||||
You have learned the basic information about command registration and command execution. Next, you can:
|
||||
|
||||
- Check out [Plugin Common APIs](/en/plugin/dev/apis/common)
|
||||
- Check out [Plugin Common APIs](/en/plugin/dev/apis/common)
|
||||
@@ -1,4 +1,6 @@
|
||||
# Component: Event Listener
|
||||
---
|
||||
title: "Component: Event Listener"
|
||||
---
|
||||
|
||||
LangBot's pipeline generates events during runtime for plugins to hook into and process. Each plugin can only have one event listener (components/event_listener/default.yaml), but can register any number of events within it.
|
||||
|
||||
@@ -98,4 +100,4 @@ Event registration is implemented through the `@self.handler` decorator, with th
|
||||
You have learned the basic information about event listeners. Next, you can:
|
||||
|
||||
- Check the `List of Monitorable Events` and `Event Context APIs` in the documentation [Pipeline Events](/en/plugin/dev/apis/pipeline-events)
|
||||
- Check out [Plugin Common APIs](/en/plugin/dev/apis/common)
|
||||
- Check out [Plugin Common APIs](/en/plugin/dev/apis/common)
|
||||
@@ -0,0 +1,266 @@
|
||||
---
|
||||
title: "Component: Knowledge Retriever"
|
||||
---
|
||||
|
||||
The Knowledge Retriever component allows plugins to provide external knowledge base retrieval capabilities for LangBot. When users create an external knowledge base in LangBot, they can choose a knowledge retriever provided by a plugin to retrieve knowledge.
|
||||
|
||||
<img width="600" src="/images/zh/plugin/dev/components/knowledge_retriever_use.png" />
|
||||
|
||||
## Adding a Knowledge Retriever Component
|
||||
|
||||
A single plugin can add any number of knowledge retrievers. Execute the command `lbp comp KnowledgeRetriever` in the plugin directory and follow the prompts to enter the knowledge retriever configuration.
|
||||
|
||||
```bash
|
||||
➜ FastGPTRetriever > lbp comp KnowledgeRetriever
|
||||
Generating component KnowledgeRetriever...
|
||||
KnowledgeRetriever name: fastgpt
|
||||
KnowledgeRetriever description: Retrieve knowledge from FastGPT knowledge bases
|
||||
Component KnowledgeRetriever generated successfully.
|
||||
```
|
||||
|
||||
This will generate `fastgpt.yaml` and `fastgpt.py` files in the `components/knowledge_retriever/` directory. The `.yaml` file defines the basic information and configuration parameters of the knowledge retriever, and the `.py` file is the handler for this retriever:
|
||||
|
||||
```bash
|
||||
➜ FastGPTRetriever > tree
|
||||
...
|
||||
├── components
|
||||
│ ├── __init__.py
|
||||
│ └── knowledge_retriever
|
||||
│ ├── __init__.py
|
||||
│ ├── fastgpt.py
|
||||
│ └── fastgpt.yaml
|
||||
...
|
||||
```
|
||||
|
||||
## Manifest File: Knowledge Retriever
|
||||
|
||||
```yaml
|
||||
apiVersion: v1 # Do not modify
|
||||
kind: KnowledgeRetriever # Do not modify
|
||||
metadata:
|
||||
name: fastgpt # Knowledge retriever name, used to identify this retriever
|
||||
label:
|
||||
en_US: FastGPT Knowledge Base # Retriever display name, shown in LangBot's UI, supports multiple languages
|
||||
zh_Hans: FastGPT 知识库
|
||||
ja_JP: FastGPT ナレッジベース
|
||||
description:
|
||||
en_US: 'Retrieve knowledge from FastGPT knowledge bases' # Retriever description, shown in LangBot's UI, supports multiple languages. Optional
|
||||
zh_Hans: '从 FastGPT 知识库中检索知识'
|
||||
ja_JP: 'FastGPT ナレッジベースから知識を取得'
|
||||
icon: assets/icon.svg # Retriever icon, displayed on the external knowledge base configuration page
|
||||
spec:
|
||||
config: # Retriever configuration parameters, users need to fill in these parameters when creating an external knowledge base
|
||||
- name: api_base_url # Parameter name
|
||||
type: string # Parameter type: string, number, boolean, select
|
||||
label:
|
||||
en_US: API Base URL
|
||||
zh_Hans: API 基础地址
|
||||
ja_JP: API ベース URL
|
||||
description:
|
||||
en_US: 'Base URL for FastGPT API'
|
||||
zh_Hans: 'FastGPT API 基础地址'
|
||||
ja_JP: 'FastGPT API ベース URL'
|
||||
default: 'http://localhost:3000' # Default parameter value
|
||||
required: true # Whether required
|
||||
- name: api_key
|
||||
type: string
|
||||
label:
|
||||
en_US: FastGPT API Key
|
||||
zh_Hans: FastGPT API Key
|
||||
ja_JP: FastGPT API キー
|
||||
description:
|
||||
en_US: 'API key from your FastGPT instance'
|
||||
zh_Hans: '从您的 FastGPT 实例获取的 API Key'
|
||||
ja_JP: 'FastGPT インスタンスから取得した API Key'
|
||||
default: ''
|
||||
required: true
|
||||
- name: search_mode # Example of select type parameter
|
||||
type: select
|
||||
label:
|
||||
en_US: Search Mode
|
||||
zh_Hans: 搜索模式
|
||||
ja_JP: 検索モード
|
||||
description:
|
||||
en_US: 'The search method to use'
|
||||
zh_Hans: '使用的搜索方法'
|
||||
ja_JP: '使用する検索方法'
|
||||
default: 'embedding'
|
||||
options: # Select type parameters need to define an option list
|
||||
- name: 'embedding'
|
||||
label:
|
||||
en_US: 'Embedding Search'
|
||||
zh_Hans: '向量搜索'
|
||||
ja_JP: '埋め込み検索'
|
||||
- name: 'fullTextRecall'
|
||||
label:
|
||||
en_US: 'Full-Text Recall'
|
||||
zh_Hans: '全文检索'
|
||||
ja_JP: '全文検索'
|
||||
- name: using_rerank # Example of boolean type parameter
|
||||
type: boolean
|
||||
label:
|
||||
en_US: Use Re-ranking
|
||||
zh_Hans: 使用重排序
|
||||
ja_JP: リランキングを使用
|
||||
description:
|
||||
en_US: 'Whether to use re-ranking'
|
||||
zh_Hans: '是否使用重排序'
|
||||
ja_JP: 'リランキングを使用するかどうか'
|
||||
default: false
|
||||
required: false
|
||||
execution:
|
||||
python:
|
||||
path: fastgpt.py # Retriever handler, do not modify
|
||||
attr: FastGPT # Class name of the retriever handler, consistent with the class name in fastgpt.py
|
||||
```
|
||||
|
||||
For configuration item format reference, see: [Plugin Manifest Configuration Format](/en/plugin/dev/basic-info)
|
||||
|
||||
## Plugin Handler
|
||||
|
||||
The following code will be generated by default (`components/knowledge_retriever/<retriever_name>.py`). You need to implement the knowledge retrieval logic in the `retrieve` method of the `FastGPT` class. Complete code can be found in [langbot-plugin-demo](https://github.com/langbot-app/langbot-plugin-demo).
|
||||
|
||||
```python
|
||||
# Auto generated by LangBot Plugin SDK.
|
||||
# Please refer to https://docs.langbot.app/en/plugin/dev/tutor.html for more details.
|
||||
...
|
||||
|
||||
class FastGPT(KnowledgeRetriever):
|
||||
|
||||
async def retrieve(self, context: RetrievalContext) -> list[RetrievalResultEntry]:
|
||||
"""Retrieve knowledge from FastGPT knowledge base"""
|
||||
|
||||
# 1. Get configuration parameters
|
||||
api_base_url = self.config.get('api_base_url', 'http://localhost:3000')
|
||||
api_key = self.config.get('api_key')
|
||||
dataset_id = self.config.get('dataset_id')
|
||||
search_mode = self.config.get('search_mode', 'embedding')
|
||||
using_rerank = self.config.get('using_rerank', False)
|
||||
|
||||
# 2. Parameter validation
|
||||
if not api_key or not dataset_id:
|
||||
logger.error("Missing required configuration: api_key or dataset_id")
|
||||
return []
|
||||
|
||||
# 3. Build API request
|
||||
url = f"{api_base_url.rstrip('/')}/api/core/dataset/searchTest"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
payload = {
|
||||
"datasetId": dataset_id,
|
||||
"text": context.query, # Get query text from RetrievalContext
|
||||
"searchMode": search_mode,
|
||||
"usingReRank": using_rerank,
|
||||
}
|
||||
|
||||
try:
|
||||
# 4. Call external API
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(url, json=payload, headers=headers, timeout=30.0)
|
||||
response.raise_for_status()
|
||||
result = response.json()
|
||||
|
||||
# 5. Parse response and convert to RetrievalResultEntry
|
||||
results = []
|
||||
for record in result.get('data', []):
|
||||
# Combine main data and auxiliary data as content
|
||||
content_text = '\n'.join([
|
||||
record.get('q', ''),
|
||||
record.get('a', '')
|
||||
]).strip()
|
||||
|
||||
# Create retrieval result entry
|
||||
entry = RetrievalResultEntry(
|
||||
id=record.get('id', ''),
|
||||
content=[ContentElement.from_text(content_text)],
|
||||
metadata={
|
||||
'dataset_id': record.get('datasetId', ''),
|
||||
'source_name': record.get('sourceName', ''),
|
||||
'score': record.get('score', 0.0),
|
||||
},
|
||||
# Convert similarity score to distance (higher score = smaller distance)
|
||||
distance=1.0 - float(record.get('score', 0.0)),
|
||||
)
|
||||
results.append(entry)
|
||||
|
||||
logger.info(f"Retrieved {len(results)} chunks from FastGPT dataset {dataset_id}")
|
||||
return results
|
||||
|
||||
except httpx.HTTPStatusError as e:
|
||||
logger.error(f"HTTP error from FastGPT API: {e.response.status_code} - {e.response.text}")
|
||||
return []
|
||||
except httpx.RequestError as e:
|
||||
logger.error(f"Request error when calling FastGPT API: {str(e)}")
|
||||
return []
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
logger.error(f"Unexpected error during retrieval: {str(e)}")
|
||||
return []
|
||||
```
|
||||
|
||||
### Retrieval Context
|
||||
|
||||
`RetrievalContext` contains context information for this retrieval:
|
||||
|
||||
```python
|
||||
class RetrievalContext(pydantic.BaseModel):
|
||||
"""Knowledge retrieval context"""
|
||||
|
||||
query: str
|
||||
"""Query text, the user's retrieval question"""
|
||||
```
|
||||
|
||||
### Retrieval Results
|
||||
|
||||
Retrieval results need to be converted to a list of `RetrievalResultEntry` objects, each representing a retrieved knowledge chunk:
|
||||
|
||||
```python
|
||||
class RetrievalResultEntry(pydantic.BaseModel):
|
||||
"""Single retrieval result entry"""
|
||||
|
||||
id: str
|
||||
"""Result ID, uniquely identifies this entry"""
|
||||
|
||||
content: list[ContentElement]
|
||||
"""Result content, create text content using ContentElement.from_text()"""
|
||||
|
||||
metadata: dict[str, Any]
|
||||
"""Result metadata, can contain any key-value pairs, such as source, score, etc."""
|
||||
|
||||
distance: float
|
||||
"""Distance score, indicates relevance to the query (smaller is more relevant)
|
||||
Usually calculated as 1.0 - similarity_score"""
|
||||
```
|
||||
|
||||
### Getting Configuration Parameters
|
||||
|
||||
Get user-configured parameter values using `self.config.get(parameter_name, default_value)`:
|
||||
|
||||
```python
|
||||
# Get string parameter
|
||||
api_base_url = self.config.get('api_base_url', 'http://localhost:3000')
|
||||
|
||||
# Get number parameters
|
||||
limit = self.config.get('limit', 5000)
|
||||
similarity = self.config.get('similarity', 0.0)
|
||||
|
||||
# Get boolean parameter
|
||||
using_rerank = self.config.get('using_rerank', False)
|
||||
|
||||
# Get select parameter
|
||||
search_mode = self.config.get('search_mode', 'embedding')
|
||||
```
|
||||
|
||||
## Testing the Retriever
|
||||
|
||||
After creation, execute the command `lbp run` in the plugin directory to start debugging. Then in LangBot:
|
||||
|
||||
1. Go to the "Knowledge Base" page
|
||||
2. Add an external knowledge base
|
||||
3. Select the knowledge retriever provided by your plugin and fill in the configuration
|
||||
|
||||
<img width="600" src="/images/zh/plugin/dev/components/knowledge_retriever_config.png" />
|
||||
|
||||
After saving, you can select this knowledge base in the LangBot pipeline.
|
||||
@@ -1,4 +1,6 @@
|
||||
# Component: Tool
|
||||
---
|
||||
title: "Component: Tool"
|
||||
---
|
||||
|
||||
LangBot's built-in Local Agent calls tools to interact with the outside world during execution. Currently, adding tools is supported through both plugins and MCP.
|
||||
|
||||
@@ -53,7 +55,7 @@ execution:
|
||||
|
||||
## Plugin Processing
|
||||
|
||||
The following code is generated by default (components/tools/<tool_name>.py). You need to implement the calling and return logic for this tool in the `call` method of the `GetWeatherAlerts` class.
|
||||
The following code is generated by default (`components/tools/<tool_name>.py`). You need to implement the calling and return logic for this tool in the `call` method of the `GetWeatherAlerts` class.
|
||||
|
||||
```python
|
||||
# Auto generated by LangBot Plugin SDK.
|
||||
@@ -75,9 +77,9 @@ class GetWeatherAlerts(Tool):
|
||||
|
||||
In the `call` method, implement this tool:
|
||||
|
||||
:::info
|
||||
<Info>
|
||||
The weather retrieval tool example comes from MCP's [Server Writing Example](https://modelcontextprotocol.io/quickstart/server).
|
||||
:::
|
||||
</Info>
|
||||
|
||||
```python
|
||||
from __future__ import annotations
|
||||
@@ -165,10 +167,10 @@ httpx
|
||||
|
||||
Now execute the command `lbp run` in the plugin directory to start debugging. Configure a model that supports tool calling in LangBot and select to use that model on the corresponding pipeline to use this tool.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/components/tool_use_in_chat.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/components/tool_use_in_chat.png" />
|
||||
|
||||
## What's Next
|
||||
|
||||
You have learned the basic usage of tools. Next, you can:
|
||||
|
||||
- Check out [Plugin Common APIs](/en/plugin/dev/apis/common)
|
||||
- Check out [Plugin Common APIs](/en/plugin/dev/apis/common)
|
||||
@@ -1,8 +1,6 @@
|
||||
# Plugin Directory Structure
|
||||
|
||||
:::info Table of Contents
|
||||
[[toc]]
|
||||
:::
|
||||
---
|
||||
title: "Plugin Directory Structure"
|
||||
---
|
||||
|
||||
This document introduces the standard directory structure and file organization specifications for LangBot plugins, helping developers create compliant plugins.
|
||||
|
||||
@@ -38,12 +36,11 @@ LangBot plugins support multilingual README documentation to provide localized p
|
||||
|
||||
**Important Specifications:**
|
||||
|
||||
1. **Root `README.md` (Required)**
|
||||
1. **`Root README.md (Required)`**
|
||||
- Must be written in **English**
|
||||
- Serves as the plugin's default documentation
|
||||
- Used as fallback when requested language version doesn't exist
|
||||
|
||||
2. **`readme/` Directory (Optional)**
|
||||
2. **`readme/ Directory (Optional)`**
|
||||
- Used to store **non-English** README documents
|
||||
- File naming format: `README_{language_code}.md`
|
||||
|
||||
@@ -51,12 +48,12 @@ LangBot plugins support multilingual README documentation to provide localized p
|
||||
|
||||
According to [RFC 4646](https://datatracker.ietf.org/doc/html/rfc4646) standard, LangBot currently supports the following language codes:
|
||||
|
||||
| Language | Language Code | Filename | Location |
|
||||
|----------|---------------|----------|----------|
|
||||
| English | `en` or `en_US` | `README.md` | **Plugin root directory** |
|
||||
| Simplified Chinese | `zh_Hans` | `README_zh_Hans.md` | `readme/` directory |
|
||||
| Traditional Chinese | `zh_Hant` | `README_zh_Hant.md` | `readme/` directory |
|
||||
| Japanese | `ja_JP` | `README_ja_JP.md` | `readme/` directory |
|
||||
| Language | Language Code | Filename | Location |
|
||||
| ------------------- | --------------- | ------------------- | ------------------------- |
|
||||
| English | `en` or `en_US` | `README.md` | **Plugin root directory** |
|
||||
| Simplified Chinese | `zh_Hans` | `README_zh_Hans.md` | `readme/` directory |
|
||||
| Traditional Chinese | `zh_Hant` | `README_zh_Hant.md` | `readme/` directory |
|
||||
| Japanese | `ja_JP` | `README_ja_JP.md` | `readme/` directory |
|
||||
|
||||
### Example Directory Structure
|
||||
|
||||
@@ -102,7 +99,6 @@ When a user requests a README in a specific language, LangBot will search in the
|
||||
- User requests Simplified Chinese (`zh_Hans`)
|
||||
- → Look for `readme/README_zh_Hans.md`
|
||||
- → If not found, return `README.md` (English version)
|
||||
|
||||
- User requests Japanese (`ja_JP`)
|
||||
- → Look for `readme/README_ja_JP.md`
|
||||
- → If not found, return `README.md` (English version)
|
||||
@@ -188,4 +184,4 @@ pillow>=9.0.0
|
||||
- [Basic Tutorial](/en/plugin/dev/tutor) - Learn how to create your first plugin
|
||||
- [Complete Plugin Configuration Information](/en/plugin/dev/basic-info) - Configure manifest.yaml
|
||||
- [Adding Components](/en/plugin/dev/components/add) - Develop plugin components
|
||||
- [Publish to Marketplace](/en/plugin/dev/publish/market) - Distribute your plugin
|
||||
- [Publish to Marketplace](/en/plugin/dev/publish/market) - Distribute your plugin
|
||||
@@ -1,14 +1,15 @@
|
||||
# Migration Guide
|
||||
---
|
||||
title: "Migration Guide"
|
||||
---
|
||||
|
||||
This tutorial highlights certain considerations. Please read the current version plugin tutorial first, then use this document as a reference for plugin migration.
|
||||
|
||||
## Migrating from 3.x Supported Asynchronous Plugins
|
||||
|
||||
:::info
|
||||
Plugin characteristics:
|
||||
<Info title="Plugin characteristics:">
|
||||
- Main time period: 2024.2 ~ 2025.8
|
||||
- Registration method: Using `@handler` decorators to register event listeners and `@llm_func` decorators to register content functions (tools) in the plugin class in `main.py`; all handler functions are asynchronous functions (async def)
|
||||
:::
|
||||
</Info>
|
||||
|
||||
- Plugin and component registration method: Changed from the previous single plugin class decorator registration method to manifest file registration method. See [Manifest File](/en/plugin/dev/basic-info); and separated different types of components independently. For details, see [Adding Components](/en/plugin/dev/components/add).
|
||||
- Message chain entities: Now refactored. The construction method of each message chain element now requires explicit passing of **named parameters**. See [Message Platform Entities](/en/plugin/dev/apis/messages).
|
||||
@@ -17,11 +18,10 @@ Plugin characteristics:
|
||||
|
||||
## Migrating from 2.x and 3.x Supported Synchronous Plugins
|
||||
|
||||
:::info
|
||||
Plugin characteristics:
|
||||
<Info title="Plugin characteristics:">
|
||||
- Main time period: 2023.1 ~ 2024.2
|
||||
- Registration method: Using `@on` decorators to register event listeners and `@func` decorators to register content functions (tools) in the plugin class in `main.py`; all handler functions are synchronous functions (def)
|
||||
:::
|
||||
</Info>
|
||||
|
||||
- Synchronous to asynchronous: Plugin runtime has now changed to fully asynchronous (based on asyncio). Please change all plugin code involving IO operations to asynchronous writing.
|
||||
- For detailed content, please refer to the above 3.x asynchronous plugin migration guide.
|
||||
- For detailed content, please refer to the above 3.x asynchronous plugin migration guide.
|
||||
@@ -1,4 +1,6 @@
|
||||
# Distribute Plugins via GitHub
|
||||
---
|
||||
title: "Distribute Plugins via GitHub"
|
||||
---
|
||||
|
||||
You can upload your plugin to GitHub, create a Release for the repository, and upload the `.lbpkg` file, allowing other users to install it in LangBot.
|
||||
|
||||
@@ -16,7 +18,7 @@ This will generate a `.lbpkg` file in the `dist` directory.
|
||||
|
||||
Upload your plugin to GitHub, then go to the Release page of your plugin repository, click to create a Release, and upload the `.lbpkg` file you just built.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/dist/github_release.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/dist/github_release.png" />
|
||||
|
||||
## Install Plugin
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Publish to Plugin Marketplace
|
||||
---
|
||||
title: "Publish to Plugin Marketplace"
|
||||
---
|
||||
|
||||
Publish plugins to [LangBot Plugin Marketplace](https://space.langbot.app/market) via CLI.
|
||||
|
||||
@@ -6,7 +8,7 @@ Publish plugins to [LangBot Plugin Marketplace](https://space.langbot.app/market
|
||||
|
||||
LangBot Space is LangBot's centralized service platform. Please visit [LangBot Space](https://space.langbot.app), click the top-right corner to log in with GitHub and create an account.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/login_space.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/login_space.png" />
|
||||
|
||||
This will redirect to GitHub authorization page, please complete authorization as prompted.
|
||||
|
||||
@@ -31,7 +33,7 @@ Waiting for verification...
|
||||
|
||||
Please click `Verification URL` to redirect to LangBot Space, enter `User Code` to complete login.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/space_device_flow.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/space_device_flow.png" />
|
||||
|
||||
```bash
|
||||
==================================================
|
||||
@@ -60,6 +62,6 @@ Plugin built successfully: dist/tmp/RockChinQ-HelloPlugin-0.1.0.lbpkg
|
||||
|
||||
You can now check your plugin submission task at [LangBot Plugin Marketplace](https://space.langbot.app/market). Please wait for approval, after which you can view your plugin in the marketplace.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/plugin_submission.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/plugin_submission.png" />
|
||||
|
||||
If you have any questions, you can send an email to `[email protected]` or contact us through [Community](/en/insight/community).
|
||||
If you have any questions, you can send an email to `[email protected]` or contact us through [Community](/en/insight/community).
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: "Code Style Guide"
|
||||
---
|
||||
|
||||
## Logging
|
||||
|
||||
In plugins, please use the `logging` module to record logs, do not use `print` statements (this will cause logs to not be output in the container environment).
|
||||
|
||||
```python
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__) # Import logging module at the beginning of any Python file and define logger object
|
||||
|
||||
logger.info('This is an info message') # Use logger.info to record info level logs
|
||||
logger.warning('This is a warning message')
|
||||
logger.error('This is an error message')
|
||||
```
|
||||
@@ -1,10 +1,12 @@
|
||||
# Plugin Development Tutorial
|
||||
---
|
||||
title: "Plugin Development Tutorial"
|
||||
---
|
||||
|
||||
## Architecture Foundation
|
||||
|
||||
In version 4.0, we introduced a high-security, high-flexibility production-grade plugin system and provided developers with rich APIs and easy-to-use supporting tools.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/plugin_system_arch.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/plugin_system_arch.png" />
|
||||
|
||||
Plugin Runtime is used to manage plugin lifecycles and coordinate interactions between LangBot and plugins. It has two operating modes: `stdio` and `websocket`. When LangBot is started directly by users (not running in a container), it uses `stdio` mode, which is common for personal users or lightweight environments. When LangBot runs in a container, it uses `websocket` mode, designed specifically for production environments.
|
||||
|
||||
@@ -43,11 +45,14 @@ The plugin class in main.py is common code for each plugin, initialized when the
|
||||
|
||||
Each component is a core functional module of your plugin, which can be [added and removed](/en/plugin/dev/components/add) as needed. Different components are called in different situations, making it easy to extend plugin functionality later. Each component directly inherits from the various component base classes under the `langbot_plugin.api.definition.components` package and contains a `plugin: BasePlugin` object, allowing you to directly call the plugin's APIs.
|
||||
|
||||
::: info
|
||||
- For detailed API documentation, please refer to [API Reference](/en/plugin/dev/apis/common).
|
||||
<Info title="- For detailed API documentation, please refer to [API Reference](/en/plugin/dev/apis/common).">
|
||||
|
||||
Please continue reading this tutorial to understand the plugin development process.
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## AI-Assisted Development
|
||||
|
||||
- [skills-LangBotplugin](https://github.com/TyperBody/skills-LangBotplugin) - Skills contributed by community member [@TyperBody](https://github.com/TyperBody), use AI to quickly develop plugins, welcome to try
|
||||
|
||||
## Installing CLI
|
||||
|
||||
@@ -69,16 +74,14 @@ lbp init
|
||||
|
||||
Follow the prompts to enter `Author`, `Description`, and other information.
|
||||
|
||||
:::info
|
||||
You can also use the `lbp init HelloPlugin` command to initialize the plugin in the subdirectory `HelloPlugin`.
|
||||
<Info title="You can also use the `lbp init HelloPlugin` command to initialize the plugin in the subdirectory `HelloPlugin`.">
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/create_plugin.png" />
|
||||
:::
|
||||
<img width="600" src="/images/zh/plugin/dev/create_plugin.png" />
|
||||
</Info>
|
||||
|
||||
This operation will generate the initial files for the plugin. You can now open the `HelloPlugin` directory in your favorite editor and start writing plugin code.
|
||||
|
||||
:::info
|
||||
If you get a "command not found" error for `lbp`, it may be because you haven't properly set the `PATH` environment variable.
|
||||
<Info title='If you get a "command not found" error for `lbp`, it may be because you have not properly set the `PATH` environment variable.'>
|
||||
You can use `python -m langbot_plugin.cli.__init__` instead of the `lbp` command.
|
||||
|
||||
For example:
|
||||
@@ -87,14 +90,13 @@ For example:
|
||||
python -m langbot_plugin.cli.__init__ init HelloPlugin
|
||||
cd HelloPlugin
|
||||
```
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## Starting Debug Mode
|
||||
|
||||
You need to first deploy and start LangBot, ensuring that Plugin Runtime is running and listening on port `5401`.
|
||||
|
||||
::: info
|
||||
Runtime has two startup modes:
|
||||
<Info title="Runtime has two startup modes:">
|
||||
|
||||
- `Stdio` mode: When you start LangBot using source code without the startup parameter `--standalone-runtime`, LangBot will automatically start Plugin Runtime as a subprocess and communicate with Plugin Runtime through `stdio` (standard input/output streams). In this case, Runtime will load plugins from the `data/plugins` directory in the LangBot root directory and listen on port `5401` of the LangBot host as a debug port.
|
||||
|
||||
@@ -105,7 +107,7 @@ Runtime has two startup modes:
|
||||
Whether in `stdio` or `websocket` mode, Plugin Runtime will listen on port `5401` of its host as a debug port for plugin debugging connections.
|
||||
|
||||
When developing plugins, we recommend starting LangBot according to the [Development Configuration](/en/develop/dev-config) method, which will start Plugin Runtime in Stdio mode, making plugin development easier.
|
||||
:::
|
||||
</Info>
|
||||
|
||||
Copy the `.env.example` file in the plugin directory to `.env`, and check or modify `DEBUG_RUNTIME_WS_URL` to your Plugin Runtime's WebSocket address.
|
||||
|
||||
@@ -119,15 +121,15 @@ Start plugin debugging, and you will see the plugin output:
|
||||
lbp run
|
||||
```
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/launch_debug_plugin.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/launch_debug_plugin.png" />
|
||||
|
||||
And you can see this plugin has been loaded in LangBot's WebUI.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/debug_plugin_loaded.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/debug_plugin_loaded.png" />
|
||||
|
||||
## What's Next
|
||||
|
||||
This tutorial will guide you through step-by-step completion of plugin functionality.
|
||||
|
||||
- Modify Plugin Information: The plugin has been created with basic plugin information. Please [complete the plugin information](/en/plugin/dev/basic-info).
|
||||
- Add Components: Plugin components are the core functional units of plugins. You can [add components](/en/plugin/dev/components/add) based on your needs.
|
||||
- Add Components: Plugin components are the core functional units of plugins. You can [add components](/en/plugin/dev/components/add) based on your needs.
|
||||
@@ -1,10 +1,12 @@
|
||||
# LangBot Plugins
|
||||
---
|
||||
title: "LangBot Plugins"
|
||||
---
|
||||
|
||||
LangBot is composed of various internal components such as Large Language Model tools, commands, messaging platform adapters, LLM requesters, and more. To meet extensibility and flexibility requirements, we have implemented a production-grade plugin system.
|
||||
|
||||
Each plugin runs in an independent process, managed uniformly by the Plugin Runtime.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/dev/plugin_system_arch.png" />
|
||||
<img width="600" src="/images/zh/plugin/dev/plugin_system_arch.png" />
|
||||
|
||||
## Plugin Structure
|
||||
|
||||
@@ -13,6 +15,7 @@ Plugins can provide the following components based on their specific functionali
|
||||
- Event Handlers: Listen to events during pipeline execution and modify context or pipelines.
|
||||
- Commands: Triggered by user command messages starting with `!` (or other configured prefixes).
|
||||
- Tools: Called by LLMs during execution of LangBot's built-in Local Agent.
|
||||
- Knowledge Retrievers: Used to retrieve relevant knowledge from external knowledge bases.
|
||||
|
||||
More component types will be supported for plugin implementation in the future.
|
||||
|
||||
@@ -21,17 +24,17 @@ More component types will be supported for plugin implementation in the future.
|
||||
Currently supports uploading plugin packages and installing plugins from the plugin marketplace.
|
||||
In LangBot's plugin management page, click the top-right corner to choose the installation method.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/install_method.png" />
|
||||
<img width="600" src="/images/zh/plugin/install_method.png" />
|
||||
|
||||
Click `Upload Local`, select `.lbpkg` files shared by others or downloaded from the Marketplace to install plugins.
|
||||
|
||||
Or click the Plugin Marketplace tab, select a plugin, and click install.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/install_from_marketplace.png" />
|
||||
<img width="600" src="/images/zh/plugin/install_from_marketplace.png" />
|
||||
|
||||
After installing plugins, you need to select the plugin in your pipeline configuration page.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/pipeline_extensions.png" />
|
||||
<img width="600" src="/images/zh/plugin/pipeline_extensions.png" />
|
||||
|
||||
## Plugin Management
|
||||
|
||||
@@ -39,14 +42,14 @@ After installing plugins, you need to select the plugin in your pipeline configu
|
||||
|
||||
Some plugins may require you to fill in specific configuration items (please refer to the plugin README instructions). Click on the plugin card to enter the plugin details page and obtain and input the required information as prompted.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/plugin_config.png" />
|
||||
<img width="600" src="/images/zh/plugin/plugin_config.png" />
|
||||
|
||||
### Updating Plugins
|
||||
|
||||
Only plugins installed from the plugin marketplace can be updated.
|
||||
|
||||
<img width="600" src="/assets/image/zh/plugin/update_plugin.png" />
|
||||
<img width="600" src="/images/zh/plugin/update_plugin.png" />
|
||||
|
||||
## Plugin Marketplace
|
||||
|
||||
The plugin marketplace can be accessed from LangBot's internal `Plugin Management` page, or you can visit the standalone site [LangBot Plugin Marketplace](https://space.langbot.app/market).
|
||||
The plugin marketplace can be accessed from LangBot's internal `Plugin Management` page, or you can visit the standalone site [LangBot Plugin Marketplace](https://space.langbot.app/market).
|
||||
@@ -1,20 +1,22 @@
|
||||
# Service API Overview
|
||||
---
|
||||
title: "Service API Overview"
|
||||
---
|
||||
|
||||
LangBot provides a set of APIs for external services to integrate. These APIs are authenticated with API keys, which are a subset of the HTTP API. To view the API documentation for frontend-backend communication, please go to the [Development](/en/develop/dev-config) section.
|
||||
|
||||
::: warning
|
||||
<Warning>
|
||||
Service API is currently in Beta and some APIs may change frequently.
|
||||
:::
|
||||
</Warning>
|
||||
|
||||
## Get API Key
|
||||
|
||||
Click the `API Keys` button in the sidebar of the WebUI to create an API Key.
|
||||
|
||||

|
||||

|
||||
|
||||
After creation, copy the API Key and save it.
|
||||
|
||||

|
||||

|
||||
|
||||
## Use API
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: "Webhooks"
|
||||
---
|
||||
|
||||
Webhooks allow you to send bot message events to external services for processing.
|
||||
|
||||
## Configure Webhooks
|
||||
|
||||
1. In LangBot WebUI, click "API Integration" in the sidebar
|
||||
2. Switch to the "Webhooks" tab
|
||||
3. Click "+" to create a new webhook
|
||||
4. Fill in:
|
||||
- **Name**: Webhook identifier
|
||||
- **URL**: Target URL to receive events
|
||||
- **Description**: Optional
|
||||
- **Status**: Enable or disable
|
||||
|
||||
## Event Format
|
||||
|
||||
### Person Message (bot.person_message)
|
||||
|
||||
```json
|
||||
{
|
||||
"uuid": "event-unique-id",
|
||||
"event_type": "bot.person_message",
|
||||
"data": {
|
||||
"bot_uuid": "bot-uuid",
|
||||
"adapter_name": "AdapterName",
|
||||
"sender": {
|
||||
"id": "user-id",
|
||||
"name": "User Name"
|
||||
},
|
||||
"message": [
|
||||
{
|
||||
"type": "Plain",
|
||||
"text": "Message content"
|
||||
}
|
||||
],
|
||||
"timestamp": 1234567890
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Group Message (bot.group_message)
|
||||
|
||||
```json
|
||||
{
|
||||
"uuid": "event-unique-id",
|
||||
"event_type": "bot.group_message",
|
||||
"data": {
|
||||
"bot_uuid": "bot-uuid",
|
||||
"adapter_name": "AdapterName",
|
||||
"group": {
|
||||
"id": "group-id",
|
||||
"name": "Group Name"
|
||||
},
|
||||
"sender": {
|
||||
"id": "user-id",
|
||||
"name": "User Name"
|
||||
},
|
||||
"message": [
|
||||
{
|
||||
"type": "Plain",
|
||||
"text": "Message content"
|
||||
}
|
||||
],
|
||||
"timestamp": 1234567890
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Response Format
|
||||
|
||||
Webhook services should return JSON:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"skip_pipeline": false
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
- **status**: Processing status (recommend "ok")
|
||||
- **skip_pipeline**: Whether to skip LangBot pipeline processing
|
||||
- `true`: Message won't continue in pipeline
|
||||
- `false`: Message proceeds normally
|
||||
|
||||
<Tip>
|
||||
`skip_pipeline` lets you completely take over message processing. When `true`, the message is only handled by your webhook service and won't trigger LangBot's AI features.
|
||||
</Tip>
|
||||
|
||||
## Integration Example
|
||||
|
||||
### Dify Workflow
|
||||
|
||||
Use the [dify-plugin-langbot-trigger](https://github.com/langbot-app/dify-plugin-langbot-trigger) plugin to receive LangBot webhook events and create workflows in Dify.
|
||||
|
||||
## Notes
|
||||
|
||||
- Webhook URL must be accessible
|
||||
- Request timeout: 15 seconds
|
||||
- Failed requests don't affect normal processing
|
||||
- Multiple webhooks execute in parallel
|
||||
- Any webhook returning `skip_pipeline: true` skips pipeline processing
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: "Using the Knowledge Base"
|
||||
---
|
||||
|
||||
LangBot natively supports RAG (Retrieval-Augmented Generation). You can create a built-in knowledge base and bind it to a pipeline, allowing the pipeline to answer questions based on the contents of the knowledge base. LangBot also supports connecting to external knowledge retrieval services (e.g., Dify, RAGFlow).
|
||||
|
||||
## Build a Built-in Knowledge Base
|
||||
|
||||
<Info>
|
||||
Creating and using a built-in knowledge base requires configuring an embedding model first. Please read [Configure Models](/en/usage/models/readme).
|
||||
</Info>
|
||||
|
||||
On the knowledge base page, click the `Create Knowledge Base` button, fill in the name, select an already configured embedding model, then click `Create`.
|
||||
|
||||
After creation, go to the "Documents" tab of your knowledge base and upload documents. LangBot will automatically parse and index these in the background.
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
|
||||
|
||||
## Connect External Knowledge Base
|
||||
|
||||
On the knowledge base page, switch to the "External Knowledge Base" tab and add an external retriever. In the dialog, select the knowledge retriever plugin to use (please install the related plugin in Plugin Management first). Supported retrievers can be found in the [Plugin Marketplace](https://space.langbot.app/market?category=KnowledgeRetriever).
|
||||
|
||||
## Use the Knowledge Base
|
||||
|
||||
Go to your pipeline configuration, under the "AI" tab, choose `Local Agent` as the runner, then select the knowledge base you just created.
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/knowledge/use_local_agent.png" alt="use_kb" />
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/knowledge/use_kb.png" alt="use_kb" />
|
||||
|
||||
<Info>
|
||||
LangBot's built-in knowledge base can be used only when the runner is set to `Local Agent`. For other runners, refer to their documentation.
|
||||
</Info>
|
||||
|
||||
Now you can use the knowledge base in `Chat Debug`, or through the bot linked to this pipeline:
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/knowledge/use_kb_in_chat.png" alt="use_kb_in_chat" />
|
||||
@@ -1,37 +1,38 @@
|
||||
# Using MCP Servers
|
||||
---
|
||||
title: "Using MCP Servers"
|
||||
---
|
||||
|
||||
|
||||
LangBot supports SSE mode MCP servers. You can add MCP servers to leverage the tool calling capabilities in large language models for better handling of LLM requests.
|
||||
LangBot supports using tools from MCP servers. You can add MCP servers to leverage the tool calling capabilities in large language models for better handling of LLM requests.
|
||||
|
||||
:::info
|
||||
MCP service only supports SSE mode.
|
||||
<Info title="- MCP service supports HTTP Streamable, SSE and stdio modes.">
|
||||
- MCP servers recommended acquisition channel: [Composio MCP](https://mcp.composio.dev/)
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## Enable Function Calling for Models
|
||||
|
||||
As shown in the image, enable the `Function Calling` feature for the model.
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/mcp/mcp_01.png" alt="enable function call" />
|
||||
<img width="400px" src="/images/zh/deploy/mcp/mcp_01.png" alt="enable function call" />
|
||||
|
||||
## Create MCP Server
|
||||
|
||||
Click `Plugin Management`, then `MCP Management`, as shown:
|
||||
|
||||
<img width="1000px" src="/assets/image/zh/deploy/mcp/mcp02.png" alt="server page" />
|
||||
<img width="1000px" src="/images/zh/deploy/mcp/mcp02.png" alt="server page" />
|
||||
|
||||
Click `Add` in the top right corner, then `Create MCP Server`,
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/mcp/mcp03.png" alt="create new mcp server" />
|
||||
<img width="400px" src="/images/zh/deploy/mcp/mcp03.png" alt="create new mcp server" />
|
||||
|
||||
For example, to use the Fetch HTML server, fill in the corresponding URL, click `Test` to test the MCP server, and click `Submit` to add the server.
|
||||
|
||||
After adding, click the switch on the card to connect to the MCP server. Click the card to view the MCP server details:
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/mcp/mcp05.png" alt="detailed server" />
|
||||
<img width="400px" src="/images/zh/deploy/mcp/mcp05.png" alt="detailed server" />
|
||||
|
||||
## Effect
|
||||
|
||||
You need to select `Local Agent` as the runner in the pipeline settings and use a model that supports function calling.
|
||||
|
||||
<img width="1000px" src="/assets/image/zh/deploy/mcp/mcp04.png" alt="dialog with mcp" />
|
||||
<img width="1000px" src="/images/zh/deploy/mcp/mcp04.png" alt="dialog with mcp" />
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: "Configure Models (Models)"
|
||||
---
|
||||
|
||||
## LangBot Models
|
||||
|
||||
LangBot Models is an official model service provided by LangBot. When you initialize a local instance with your LangBot Space account, available models will be automatically added to your instance without any configuration. You will receive a certain amount of free quota to get started quickly.
|
||||
|
||||
<img src="/images/zh/deploy/models/langbot_models.png" alt="langbot_models" />
|
||||
|
||||
For specific available models, please check [LangBot Space](https://space.langbot.app/models).
|
||||
|
||||
## Custom Models
|
||||
|
||||
You can also add models from other sources.
|
||||
|
||||
### LLM Model
|
||||
|
||||
Models will be used by pipelines to process messages. The first model you configure will be set as the model for the default pipeline.
|
||||
|
||||

|
||||
|
||||
You can add multiple models, and then select which model to use in the pipeline.
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/models/model_config.png" alt="model_config" />
|
||||
|
||||
Enter these four parameters: `Model Name`, `Model Provider`, `Request URL`, and `API Key`, then submit.
|
||||
|
||||
For model capabilities, please choose according to the specific model characteristics:
|
||||
|
||||
- Visual Capability: Needs to be enabled to recognize images
|
||||
|
||||
- Function Calling: Needs to be enabled to use Agent tools in conversations
|
||||
|
||||
### Embedding Model
|
||||
|
||||
Embedding models are used to compute vector representations of messages. If you need to use knowledge bases, please configure this model.
|
||||
|
||||
<img width="400px" src="/images/zh/deploy/models/embedding_model.png" alt="embedding_model" />
|
||||
|
||||
Enter these four parameters: `Model Name`, `Model Provider`, `Request URL`, and `API Key`, then submit. After that, please configure the knowledge base to use this model.
|
||||
|
||||
### Using seekdb Built-in Embedding Model (Zero Configuration)
|
||||
The system has integrated the official embedding model provided by seekdb, no parameters required.
|
||||
- On the "Embedding Model" page, select "seekdb-built-in";
|
||||
- Click "Save" to use it immediately;
|
||||
- Then select this model in your knowledge base to take effect.
|
||||
@@ -1,24 +1,26 @@
|
||||
# Integrating Coze API
|
||||
---
|
||||
title: "Integrating Coze API"
|
||||
---
|
||||
|
||||
This document explains how to obtain the Token and Bot ID from the Coze platform and enter them into the LangBot pipeline configuration.
|
||||
|
||||
## 1. Obtaining the Token and Bot ID
|
||||
|
||||
1. Log in to the Coze platform and enter your developer console.
|
||||

|
||||

|
||||
|
||||
2. In "API Management", create and copy the token.
|
||||

|
||||

|
||||
|
||||
:::info
|
||||
<Info>
|
||||
In Coze authorization, coze.cn supports long-term authorization through "Service Identities and Credentials", while coze.com only provides Personal Access Tokens.
|
||||
:::
|
||||
</Info>
|
||||
|
||||
3. Select your own agent (or create a new one) from the project development section. The obtained ID is the `bot_id`.
|
||||

|
||||

|
||||
|
||||
* Make sure to select the API option when publishing the agent
|
||||

|
||||

|
||||
|
||||
Please securely store the following two pieces of information:
|
||||
- **token**: The token generated by the Coze platform
|
||||
@@ -35,7 +37,7 @@ Please securely store the following two pieces of information:
|
||||
- **bot_id**: Paste the corresponding Bot ID
|
||||
- Please select the `API Base URL` according to the Coze site you are using: coze.cn please fill in `https://api.coze.cn`; coze.com please fill in `https://api.coze.com`
|
||||
|
||||

|
||||

|
||||
|
||||
4. Click "Save" to complete the configuration
|
||||
|
||||
@@ -46,4 +48,4 @@ Once completed, you can invoke the Coze agent within this pipeline for dialogue
|
||||
- **Save fails or invocation returns an error**: Please verify that the token and bot_id are correct and do not contain extra spaces
|
||||
- **Unable to select `Coze API`**: Please confirm whether the current version supports this runner. If not yet supported, please upgrade to a version that includes the Coze runner
|
||||
|
||||
For more general pipeline configuration instructions, please refer to [Modifying Dialogue Pipeline Configuration](/en/deploy/pipelines/readme)
|
||||
For more general pipeline configuration instructions, please refer to [Modifying Dialogue Pipeline Configuration](/en/usage/pipelines/readme)
|
||||
@@ -1,4 +1,6 @@
|
||||
# Using Dify with LangBot
|
||||
---
|
||||
title: "Using Dify with LangBot"
|
||||
---
|
||||
|
||||
[Dify](https://dify.ai) is an open-source large language model (LLM) application development platform. It combines the concepts of Backend as Service and LLMOps, enabling developers to quickly build production-grade generative AI applications.
|
||||
Dify can create chat assistants (including Chatflow), Agents, text generation applications, workflows, and other types of applications.
|
||||
@@ -11,32 +13,30 @@ 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.
|
||||
|
||||

|
||||

|
||||
|
||||
Save the API server and API key for configuring LangBot's pipeline `AI Capability`.
|
||||
|
||||
:::info
|
||||
The above is an example for Dify cloud service version. If you are using the self-hosted community version, please use your own Dify service address as the `base-url` in LangBot, and add `/v1` as the path.
|
||||
<Info title="The above is an example for Dify cloud service version. If you are using the self-hosted community version, please use your own Dify service address as the `base-url` in LangBot, and add `/v1` as the path.">
|
||||
|
||||
- If LangBot and Dify are deployed on the same host and both are deployed using Docker, you can refer to the article: [Network Configuration Details](/zh/workshop/network-details.html#langbot-%E5%92%8C%E6%B6%88%E6%81%AF%E5%B9%B3%E5%8F%B0%E5%9D%87%E8%BF%90%E8%A1%8C%E5%9C%A8-docker-%E5%AE%B9%E5%99%A8%E4%B8%AD). In this case, add `langbot-network` to the `networks` of all containers in the docker-compose.yaml file that starts Dify, add the container name `dify-nginx` to the `nginx` container, and finally set `base-url` to `http://dify-nginx/v1` in the LangBot configuration.
|
||||
- For other cases, please consult your company's operations team.
|
||||
:::
|
||||
</Info>
|
||||
|
||||
## Configuring LangBot
|
||||
|
||||
Open the LangBot WebUI page, add a new pipeline or switch to the AI capability configuration page in an existing pipeline.
|
||||
|
||||

|
||||

|
||||
|
||||
::: info
|
||||
### Workflow Output Key
|
||||
<Info title="### Workflow Output Key">
|
||||
|
||||
If you are using a Dify workflow application, please use `summary` as the key to pass the output content.
|
||||
|
||||

|
||||

|
||||
|
||||
## Output Processing
|
||||
|
||||
When using a workflow application or Agent application, if you enable `track-function-calls` in LangBot's pipeline `Output Processing`, a message of `calling function xxx` will be output to the user when Dify executes each tool call.
|
||||
However, if you are using `ChatFlow` under the `chat` application (Chat Assistant -> Workflow Orchestration), it will only output the text returned by the Answer (direct reply) node regardless of the settings.
|
||||
:::
|
||||
</Info>
|
||||
@@ -1,4 +1,6 @@
|
||||
# Using Langflow with LangBot
|
||||
---
|
||||
title: "Using Langflow with LangBot"
|
||||
---
|
||||
|
||||
[Langflow](https://langflow.com/) is an open-source project for building and deploying AI-based Agents and Workflows. It supports local and cloud deployment, and provides APIs for other applications to integrate.
|
||||
|
||||
@@ -10,22 +12,22 @@ Please follow the [Langflow documentation](https://langflow.com/docs/introductio
|
||||
|
||||
As an example of the default template's Simple Agent:
|
||||
|
||||

|
||||

|
||||
|
||||
You can modify the workflow according to your needs:
|
||||
|
||||

|
||||

|
||||
|
||||
## Configuring LangBot
|
||||
|
||||
Open the LangBot WebUI page, add a new pipeline or switch to the AI capability configuration page in an existing pipeline, and select `Langflow API` as the runner.
|
||||
|
||||

|
||||

|
||||
|
||||
Fill in the other settings according to the prompts, including `Base URL` (fill in according to actual network conditions), `API Key`, `Flow ID`, etc. The API Key can be obtained from Langflow's Settings:
|
||||
|
||||

|
||||

|
||||
|
||||
Flow ID can be obtained by clicking the `Share` -> `API access` button in the top right corner of the edit page and obtaining it from the example code:
|
||||
|
||||

|
||||

|
||||
@@ -1,4 +1,6 @@
|
||||
# Using n8n with LangBot
|
||||
---
|
||||
title: "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.
|
||||
|
||||
@@ -8,42 +10,40 @@ LangBot currently supports triggering workflows and receiving responses through
|
||||
|
||||
Please open the configuration page of an existing pipeline or create a new pipeline (recommended) and open the configuration page. Select `n8n Workflow API` as the runner in `AI`.
|
||||
|
||||

|
||||

|
||||
|
||||
Then configure and fill in the other settings according to the content below.
|
||||
|
||||
## Configuring n8n Workflow Connection
|
||||
|
||||

|
||||

|
||||
or
|
||||

|
||||

|
||||
|
||||
Select `Webhook` or `On chat message` as the trigger and configure as follows:
|
||||
- Webhook:
|
||||

|
||||

|
||||
- On chat message:
|
||||

|
||||

|
||||
|
||||
:::info
|
||||
If you need streaming responses, set `Response Mode` to `Streaming`.
|
||||

|
||||
:::
|
||||
<Info title="If you need streaming responses, set `Response Mode` to `Streaming`.">
|
||||

|
||||
</Info>
|
||||
|
||||
:::info
|
||||
Authentication corresponds to the authentication methods in LangBot's pipeline configuration, which you can modify as needed.
|
||||
<Info title="Authentication corresponds to the authentication methods in LangBot's pipeline configuration, which you can modify as needed.">
|
||||
|
||||

|
||||
:::
|
||||

|
||||
</Info>
|
||||
|
||||
Configure the node that calls the AI model as `AI Agent`, following the setup below:
|
||||
> For streaming responses, add the items highlighted in the red box. If you don't need streaming, you can skip this.
|
||||
|
||||

|
||||

|
||||
|
||||
For the workflow response content in n8n, please use the `Respond to Webhook` node and configure it according to the image below (if you choose streaming responses with the `AI Agent` node, you do not need this step):
|
||||
|
||||

|
||||

|
||||
|
||||
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.
|
||||
After completing the n8n workflow configuration, please click `Active` at the top to enable the workflow.
|
||||
@@ -1,10 +1,12 @@
|
||||
# Modify Dialogue Pipeline Configuration (Pipelines)
|
||||
---
|
||||
title: "Modify Dialogue Pipeline Configuration (Pipelines)"
|
||||
---
|
||||
|
||||
The pipeline controls the processing flow after receiving a message, as well as the information exchange with the large language model. Each bot can be bound to one pipeline, and the same pipeline can be bound to multiple bots.
|
||||
|
||||
LangBot automatically creates a default pipeline when first started. When creating a bot, it is automatically bound to the default pipeline. When creating the first model, it is automatically set as the model for the default pipeline.
|
||||
|
||||

|
||||

|
||||
|
||||
You can create multiple pipelines for different bots to adapt to different scenarios.
|
||||
|
||||
@@ -20,28 +22,33 @@ AI capabilities are mainly divided into two parts: selecting the runner and conf
|
||||
|
||||
The runner defines how to schedule the large model to process messages. The default is `Built-in Agent`, which is a multi-round Agent strategy implemented by LangBot. Only when this runner is selected will the models and tools configured internally in LangBot be used.
|
||||
|
||||
*<!--  -->*
|
||||
{/*  */}
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/pipelines/edit_pipeline_ai.png" alt="edit_pipeline" />
|
||||
<img width="400px" src="/images/zh/deploy/pipelines/edit_pipeline_ai.png" alt="edit_pipeline" />
|
||||
|
||||
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.
|
||||
|
||||
<img width="400px" src="/assets/image/zh/deploy/pipelines/more_runner.png" alt="more_runner" />
|
||||
<img width="400px" src="/images/zh/deploy/pipelines/more_runner.png" alt="more_runner" />
|
||||
|
||||
- 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).
|
||||
- For detailed steps on connecting to Dify, you can [refer to the tutorial](/en/usage/pipelines/dify.html).
|
||||
- For detailed steps on connecting to n8n, you can [refer to the tutorial](/en/usage/pipelines/n8n.html).
|
||||
|
||||
### Conversation Variables
|
||||
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):
|
||||
|
||||
- `launcher_type`: Launcher object type, `person` for private chat, `group` for group chat
|
||||
- `launcher_id`: Launcher object ID, user ID for private chat, group ID for group chat
|
||||
- `sender_id`: Sender ID
|
||||
- `user_message_text`: The plain text of the user message
|
||||
- `session_id`: User session ID, `person_<id>` for private chat, `group_<id>` for group chat
|
||||
- `conversation_id`: String, user session ID, generated by LangBot. It will be regenerated after the user resets the session
|
||||
- `msg_create_time`: Numeric type, timestamp (seconds) when this message was received
|
||||
- `msg_create_time`: Numeric type, timestamp (seconds) when this message was received
|
||||
- `group_name`: Group name, only set when receiving group messages
|
||||
- `sender_name`: Sender name
|
||||
|
||||
You can [customize any variable through plugins](/zh/plugin/dev/apis/common.html#set-request-variables).
|
||||
You can [customize any variable through plugins](/en/plugin/dev/apis/common.html#set-request-variables).
|
||||
|
||||

|
||||

|
||||
|
||||
## Other Configurations
|
||||
|
||||