refactor: migration to mintlify

* 重构文档结构:移除 docs 目录,调整文件组织结构

* Reorder "插件 SDK API" section in docs.json

* Refactor and clarify various documentation sections

* Refine warnings and info boxes across multiple docs

* Refactor and simplify Japanese documentation content

* Update package.json to include mintlify as a dependency and add pnpm-lock.yaml for dependency management

* Update blog link and add description in docs.json

---------

Co-authored-by: Junyan Chin <[email protected]>
This commit is contained in:
Xiaoyu Su
2026-02-21 23:55:53 +08:00
committed by GitHub
co-authored by Junyan Chin
parent e795e624b2
commit 310c566148
542 changed files with 10936 additions and 9016 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
node_modules/
docs/.vitepress/cache/
docs/.vitepress/dist
docs/.vitepress/.temp/
.mintlify/
.DS_Store
/.omc
.mintlify-last/

Before

Width:  |  Height:  |  Size: 217 KiB

After

Width:  |  Height:  |  Size: 217 KiB

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

+624
View File
@@ -0,0 +1,624 @@
{
"$schema": "https://mintlify.com/docs.json",
"theme": "mint",
"name": "LangBot",
"colors": {
"primary": "#4692dd",
"light": "#4692dd",
"dark": "#4692dd"
},
"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."
}
-887
View File
@@ -1,887 +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' }
import specJa from '../assets/service-api-openapi-ja.json' with { type: 'json' }
const sidebarZh = useSidebar({
spec: specZh,
linkPrefix: '/zh/tags/',
})
const sidebarEn = useSidebar({
spec: specEn,
linkPrefix: '/en/tags/',
})
const sidebarJa = useSidebar({
spec: specJa,
linkPrefix: '/ja/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",
},
},
sitemap: {
hostname: 'https://docs.langbot.app',
},
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://space.langbot.app"},
{ text: "博客", link: "https://blog.langbot.app/zh/" },
{ 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", collapsed: true, items: [
{ text: "消息平台特性支持性", link: "/zh/insight/platform-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: "系统环境设置",
link: "/zh/deploy/settings",
},
{
text: "更新 LangBot",
link: "/zh/deploy/update",
},
],
},
{
text: "构建机器人",
items: [
{
text: "配置机器人",
collapsed: true,
link: "/zh/usage/platforms/readme",
items: [
{
text: "OneBot v11",
collapsed: true,
items: [
{
text: "NapCat",
link: "/zh/usage/platforms/qq/aiocqhttp/napcat",
},
{
text: "Lagrange",
link: "/zh/usage/platforms/qq/aiocqhttp/lagrange",
},
{
text: "llonebot",
link: "/zh/usage/platforms/qq/aiocqhttp/llonebot",
},
],
},
{
text: "QQ 官方机器人",
collapsed: true,
items: [
{
text: "Webhook 方式",
link: "/zh/usage/platforms/qq/official_webhook",
},
{
text: "WebSocket 方式",
link: "/zh/usage/platforms/qq/official",
},
],
},
{
text: "企业微信",
collapsed: true,
items: [
{
text: "内部应用",
link: "/zh/usage/platforms/wecom/wecom",
},
{
text: "对外客服",
link: "/zh/usage/platforms/wecom/wecomcs",
},
{
text: "智能机器人",
link: "/zh/usage/platforms/wecom/wecombot",
}
],
},
{
text: "微信",
collapsed: true,
items: [
{
text: "WeChatPadPro",
link: "/zh/usage/platforms/wechat/wechatpad.md"
},
],
},
{ text: "微信公众号", link: "/zh/usage/platforms/wxoa.md" },
{ text: "飞书", link: "/zh/usage/platforms/lark" },
{ text: "钉钉", link: "/zh/usage/platforms/dingtalk.md" },
{ text: "Discord", link: "/zh/usage/platforms/discord" },
{ text: "Telegram", link: "/zh/usage/platforms/telegram" },
{ text: "Slack", link: "/zh/usage/platforms/slack" },
{ text: "LINE", link: "/zh/usage/platforms/line" },
{ text: "KOOK", link: "/zh/usage/platforms/kook" },
],
},
{
text: "配置模型",
link: "/zh/usage/models/readme",
},
{
text: "修改对话流水线",
link: "/zh/usage/pipelines/readme",
collapsed: true,
items: [
{ text: "Dify", link: "/zh/usage/pipelines/dify" },
{ text: "n8n", link: "/zh/usage/pipelines/n8n" },
{ text: "Langflow", link: "/zh/usage/pipelines/langflow" },
{ text: "TBox", link: "/zh/usage/pipelines/tbox" },
{ text: "Coze", link: "/zh/usage/pipelines/coze" },
],
},
{
text: "使用知识库",
link: "/zh/usage/knowledge/readme",
},
{
text: "使用 MCP 服务",
link: "/zh/usage/mcp/readme"
},
{
text: "对话命令",
link: "/zh/deploy/command",
},
],
},
{
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: "组件:知识检索器", link: "/zh/plugin/dev/components/knowledge-retriever" },
],
},
{
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/style" },
{ 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: "将 LangBot 用于生产环境",
collapsed: true,
items: [
{ text: "配置 HTTP 反向代理或通过网关访问 LangBot", link: "/zh/workshop/production/proxy-and-ssl" },
]
},
{
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" },
{ text: "Webhooks", link: "/zh/tags/webhook" },
...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: "Market", link: "https://space.langbot.app" },
{ text: "Blog", link: "https://blog.langbot.app/en/" },
{ 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",
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: "System Settings",
link: "/en/deploy/settings",
},
{
text: "Update LangBot",
link: "/en/deploy/update",
},
],
},
{
text: "Build Your Bot",
items: [
{
text: "Configure Bots",
collapsed: true,
link: "/en/usage/platforms/readme",
items: [
{ text: "Discord", link: "/en/usage/platforms/discord" },
{ text: "Telegram", link: "/en/usage/platforms/telegram" },
{ text: "Slack", link: "/en/usage/platforms/slack" },
{ text: "LINE", link: "/en/usage/platforms/line" },
{ text: "KOOK", link: "/en/usage/platforms/kook" },
{ text: "Lark", link: "/en/usage/platforms/lark" },
{ text: "DingTalk", link: "/en/usage/platforms/dingtalk" },
{
text: "OneBot v11",
collapsed: true,
items: [
{
text: "NapCat",
link: "/en/usage/platforms/qq/aiocqhttp/napcat",
},
{
text: "Lagrange",
link: "/en/usage/platforms/qq/aiocqhttp/lagrange",
},
{
text: "llonebot",
link: "/en/usage/platforms/qq/aiocqhttp/llonebot",
},
],
},
{
text: "QQ Official Bot",
collapsed: true,
items: [
{
text: "Webhook Method",
link: "/en/usage/platforms/qq/official_webhook",
},
{
text: "WebSocket Method",
link: "/en/usage/platforms/qq/official",
},
],
},
{
text: "WeCom (Enterprise WeChat)",
collapsed: true,
items: [
{
text: "Internal Application",
link: "/en/usage/platforms/wecom/wecom",
},
{
text: "External Customer Service",
link: "/en/usage/platforms/wecom/wecomcs",
},
{
text: "Intelligent Bot",
link: "/en/usage/platforms/wecom/wecombot",
}
],
},
{ text: "WeChat Official Account", link: "/en/usage/platforms/wxoa" },
],
},
{
text: "Configure Models",
link: "/en/usage/models/readme",
},
{
text: "Modify Dialogue Pipeline",
link: "/en/usage/pipelines/readme",
collapsed: true,
items: [
{ text: "Dify", link: "/en/usage/pipelines/dify" },
{ text: "n8n", link: "/en/usage/pipelines/n8n" },
{ text: "Langflow", link: "/en/usage/pipelines/langflow" },
],
},
{
text: "Using Knowledge Base",
link: "/en/usage/knowledge/readme",
},
{
text: "Using MCP Services",
link: "/en/usage/mcp/readme",
},
{
text: "Dialogue Commands",
link: "/en/deploy/command",
},
],
},
{
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: "Component: Knowledge Retriever", link: "/en/plugin/dev/components/knowledge-retriever" },
],
},
{
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: "Code Style", link: "/en/plugin/dev/style" },
{ 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: "Using LangBot in Production Environment",
collapsed: true,
items: [
{ text: "Configuring HTTP Reverse Proxy or Accessing LangBot via Gateway", link: "/en/workshop/production/proxy-and-ssl" },
],
},
{
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" },
{ text: "Webhooks", link: "/en/tags/webhook" },
...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",
},
],
},
},
ja: {
title: "LangBot ドキュメント",
label: "日本語",
lang: "ja",
link: "/ja/",
themeConfig: {
nav: [
{ text: "ホーム", link: "https://langbot.app" },
{ text: "マーケット", link: "https://space.langbot.app" },
{ text: "ブログ", link: "https://blog.langbot.app/en/" },
{ text: "ロードマップ", link: "https://langbot.featurebase.app/roadmap" },
],
sidebar: [
{
text: "概要",
items: [
{ text: "はじめに(必読)", link: "/ja/insight/guide" },
{ text: "コミュニティリソース", link: "/ja/insight/community" },
{ text: "機能一覧", link: "/ja/insight/features" },
],
},
{
text: "デプロイ",
items: [
{
text: "LangBot をデプロイ",
collapsed: true,
items: [
{ text: "パッケージマネージャーでデプロイ", link: "/ja/deploy/langbot/package" },
{ text: "Docker でデプロイ", link: "/ja/deploy/langbot/docker" },
{
text: "1Panel でデプロイ",
link: "/ja/deploy/langbot/one-click/1panel",
},
{
text: "aaPanel でデプロイ",
link: "/ja/deploy/langbot/one-click/bt",
},
{ text: "手動デプロイ", link: "/ja/deploy/langbot/manual" },
],
},
{
text: "システム設定",
link: "/ja/deploy/settings",
},
{
text: "LangBot を更新",
link: "/ja/deploy/update",
},
],
},
{
text: "ボットを構築",
items: [
{
text: "ボットを設定",
collapsed: true,
link: "/ja/usage/platforms/readme",
items: [
{ text: "Discord", link: "/ja/usage/platforms/discord" },
{ text: "Telegram", link: "/ja/usage/platforms/telegram" },
{ text: "Slack", link: "/ja/usage/platforms/slack" },
{ text: "LINE", link: "/ja/usage/platforms/line" },
{ text: "KOOK", link: "/ja/usage/platforms/kook" },
{ text: "Lark", link: "/ja/usage/platforms/lark" },
{ text: "DingTalk", link: "/ja/usage/platforms/dingtalk" },
{
text: "OneBot v11",
collapsed: true,
items: [
{
text: "NapCat",
link: "/ja/usage/platforms/qq/aiocqhttp/napcat",
},
{
text: "Lagrange",
link: "/ja/usage/platforms/qq/aiocqhttp/lagrange",
},
{
text: "llonebot",
link: "/ja/usage/platforms/qq/aiocqhttp/llonebot",
},
],
},
{
text: "QQ 公式ボット",
collapsed: true,
items: [
{
text: "Webhook 方式",
link: "/ja/usage/platforms/qq/official_webhook",
},
{
text: "WebSocket 方式",
link: "/ja/usage/platforms/qq/official",
},
],
},
{
text: "WeCom(企業微信)",
collapsed: true,
items: [
{
text: "内部アプリケーション",
link: "/ja/usage/platforms/wecom/wecom",
},
{
text: "外部カスタマーサービス",
link: "/ja/usage/platforms/wecom/wecomcs",
},
{
text: "インテリジェントボット",
link: "/ja/usage/platforms/wecom/wecombot",
}
],
},
{ text: "WeChat 公式アカウント", link: "/ja/usage/platforms/wxoa" },
],
},
{
text: "モデルを設定",
link: "/ja/usage/models/readme",
},
{
text: "対話パイプラインを変更",
link: "/ja/usage/pipelines/readme",
collapsed: true,
items: [
{ text: "Dify", link: "/ja/usage/pipelines/dify" },
{ text: "n8n", link: "/ja/usage/pipelines/n8n" },
{ text: "Langflow", link: "/ja/usage/pipelines/langflow" },
],
},
{
text: "ナレッジベースを使用",
link: "/ja/usage/knowledge/readme",
},
{
text: "MCP サービスを使用",
link: "/ja/usage/mcp/readme",
},
{
text: "対話コマンド",
link: "/ja/deploy/command",
},
],
},
{
text: "プラグイン",
items: [
{ text: "プラグイン紹介", link: "/ja/plugin/plugin-intro" },
{
text: "プラグイン開発",
collapsed: true,
items: [
{ text: "基本チュートリアル", link: "/ja/plugin/dev/tutor" },
{ text: "プラグイン設定情報を完成", link: "/ja/plugin/dev/basic-info" },
{ text: "ディレクトリ構造", link: "/ja/plugin/dev/directory-structure" },
{
text: "コンポーネント開発",
collapsed: true,
items: [
{ text: "コンポーネントを追加", link: "/ja/plugin/dev/components/add" },
{ text: "コンポーネント:イベントリスナー", link: "/ja/plugin/dev/components/event-listener" },
{ text: "コンポーネント:コマンド", link: "/ja/plugin/dev/components/command" },
{ text: "コンポーネント:ツール", link: "/ja/plugin/dev/components/tool" },
{ text: "コンポーネント:ナレッジレトリーバー", link: "/ja/plugin/dev/components/knowledge-retriever" },
],
},
{
text: "API リファレンス",
collapsed: true,
items: [
{ text: "プラグイン共通 API", link: "/ja/plugin/dev/apis/common" },
{ text: "パイプラインイベント", link: "/ja/plugin/dev/apis/pipeline-events" },
{ text: "メッセージプラットフォームエンティティ", link: "/ja/plugin/dev/apis/messages" },
],
},
{ text: "コードスタイル", link: "/ja/plugin/dev/style" },
{ text: "移行ガイド", link: "/ja/plugin/dev/migration" },
{
text: "プラグインを配布", collapsed: true,
items: [
{ text: "マーケットプレイスに公開", link: "/ja/plugin/dev/publish/market" },
{ text: "GitHub で配布", link: "/ja/plugin/dev/publish/github" },
]
},
],
},
{ text: "システム互換性", link: "/ja/plugin/compatibility" },
],
},
{
text: "ワークショップ",
items: [
{
text: "本番環境で LangBot を使用",
collapsed: true,
items: [
{ text: "HTTP リバースプロキシの設定またはゲートウェイ経由で LangBot にアクセス", link: "/ja/workshop/production/proxy-and-ssl" },
],
},
{
text: "メッセージプラットフォームアダプターの実装方法",
link: "/ja/workshop/impl-platform-adapter",
},
{
text: "コンテナネットワーク設定の詳細",
link: "/ja/workshop/network-details",
},
{
text: "New API を使用して複数チャネルのモデルを中継",
link: "/ja/workshop/newapi-integration"
},
{
text: "PPIO API モデルの統合",
link: "/ja/workshop/ppio-integration"
},
{
text: "302.AI モデルの統合",
link: "/ja/workshop/302ai-integration"
}
],
},
{
text: "[Beta] Service API リファレンス",
items: [
{ text: "概要", link: "/ja/tags/readme" },
{ text: "Webhooks", link: "/ja/tags/webhook" },
...sidebarJa.generateSidebarGroups({
linkPrefix: '/ja/tags/',
}).map(group => ({
...group,
collapsed: true,
})),
],
},
{
text: "開発",
items: [
{ text: "開発設定", link: "/ja/develop/dev-config" },
{ text: "コンポーネントアーキテクチャ", link: "/ja/develop/comp-arch" },
{ text: "プラグインランタイム", link: "/ja/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,
});
-6
View File
@@ -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);
}
-72
View File
@@ -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 })
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/en/usage/knowledge/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/en/usage/models/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/en/usage/pipelines/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/en/usage/platforms/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
# Component Architecture
![Component Architecture Diagram](/assets/image/zh/develop/comp_arch/develop_comp_arch_1.png)
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/en/insight/guide'
</script>
-96
View File
@@ -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:
![](/assets/image/zh/plugin/dev/apis/plugin_dev_messages_01.png)
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 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 |
-13
View File
@@ -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" />
-18
View File
@@ -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`,
},
}
})
},
}
-16
View File
@@ -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 />
-17
View File
@@ -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`,
},
}
})
},
}
-5
View File
@@ -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.
![model](/assets/image/zh/workshop/302ai-integration/model.png)
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/zh/insight/guide'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/ja/usage/knowledge/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/ja/usage/models/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/ja/usage/pipelines/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/ja/usage/platforms/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
# コンポーネントアーキテクチャ
![コンポーネントアーキテクチャ図](/assets/image/zh/develop/comp_arch/develop_comp_arch_1.png)
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/ja/insight/guide'
</script>
-96
View File
@@ -1,96 +0,0 @@
# メッセージプラットフォームエンティティ
:::info 目次
[[toc]]
:::
LangBotは複数のメッセージングプラットフォームをサポートしており、各プラットフォームには異なる`メッセージエンティティ`フォーマットがあります。これらの違いを抽象化するために、統一された標準を実装しました。プラグイン開発者は、プラグイン内でこのページに記載されているメッセージエンティティを習得して使用するだけで、LangBotの内部メッセージ処理ロジックがメッセージの解析と変換を自動的に処理します。
## メッセージチェーン
メッセージングプラットフォーム上の`メッセージ`は、AI対話に使用されるメッセージとは異なります。メッセージングプラットフォーム上のメッセージは、`メッセージチェーン`の形式で記述されます。QQに表示される各独立したメッセージはメッセージチェーンであり、`テキスト`、`画像`、`@メンション`などのさまざまな`メッセージチェーンコンポーネント`を含むことができます。例えば:
![](/assets/image/zh/plugin/dev/apis/plugin_dev_messages_01.png)
これは、1つのPlainコンポーネント(Hello World)と1つのImageコンポーネント(Usagi)を含むメッセージチェーンです。
メッセージチェーンとメッセージチェーンコンポーネントの定義は、`langbot_plugin.api.entities.builtin.platform.message`にあります。
### メッセージチェーンの構築
まず、`langbot_plugin.api.entities.builtin.platform.message`パッケージをインポートして、その中のメッセージコンポーネントを使用してください。
```python
from langbot_plugin.api.entities.builtin.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.builtin.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(企業微信) | wecom | adapter.bot | libs/wecom_api/api.pyの`WecomClient`内の`send_image`メソッドを参照してHTTPリクエストメソッドを確認し、具体的なインターフェースドキュメントについてはWeCom APIドキュメントを参照してください |
| WeChat公式アカウント | officialaccount | - | インターフェースドキュメントについてはWeChat公式アカウントAPIドキュメントを参照してください。認証情報はadapter.botから取得できます |
| Lark | lark | adapter.api_client | Lark SDKのAPI Clientオブジェクトです。詳細については[oapi-sdk-python](https://github.com/larksuite/oapi-sdk-python)を参照してください |
| DingTalk | dingtalk | - | 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を参照してください |
-13
View File
@@ -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" />
-18
View File
@@ -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`,
},
}
})
},
}
-16
View File
@@ -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 />
-17
View File
@@ -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`,
},
}
})
},
}
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/zh/usage/knowledge/readme'
</script>
-43
View File
@@ -1,43 +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://docker.github.net.cn/network/proxy/),以便保证 LangBot 在运行期间的网络访问通畅。
:::
首次启动会输出创建配置文件的提示,请继续按照文件配置。
容器会映射`5300`端口供 WebUI 使用,您可以访问`http://127.0.0.1:5300`查看 WebUI。
还会映射`2280-2290`端口供使用 OneBot 协议的消息平台适配器反向连接。
完成 LangBot 部署后,请继续阅读:
- [配置机器人文档](/zh/deploy/platforms/readme)。
- [配置模型文档](/zh/deploy/models/readme)。
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/zh/usage/models/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/zh/usage/pipelines/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/zh/usage/platforms/readme'
</script>
-3
View File
@@ -1,3 +0,0 @@
# 组件架构
![组件架构图](/assets/image/zh/develop/comp_arch/develop_comp_arch_1.png)
-3
View File
@@ -1,3 +0,0 @@
<script setup>
window.location.href = '/zh/insight/guide'
</script>
-97
View File
@@ -1,97 +0,0 @@
# 消息平台实体
:::info 目录
[[toc]]
:::
LangBot 支持多种消息平台,每个消息平台的`消息实体`格式均不相同。为了屏蔽这些差异,我们实现了一套统一的标准。插件开发者只需要掌握并在插件中使用此页所述的消息实体,LangBot 内部的消息处理逻辑能够自动完成消息的解析和转换。
## 消息链
消息平台的`消息`不同于用于 AI 交互的消息,消息平台的消息以`消息链`的形式描述,QQ 上展示的每一个独立的消息就是一条消息链,消息链中可以包含`文字`、`图片`、`@组件`等多种`消息链组件`,例如:
![](/assets/image/zh/plugin/dev/apis/plugin_dev_messages_01.png)
这就是一个消息链,包含 一个 Plain 组件(Hello World)和 一个 Image 组件(乌萨奇)
消息链和消息链组件的定义位于`langbot_plugin.api.entities.builtin.platform.message`中。
### 构造消息链
请先引入`langbot_plugin.api.entities.builtin.platform.message`包,才能使用其中的消息组件。
```python
from langbot_plugin.api.entities.builtin.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.builtin.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 |
-13
View File
@@ -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" />
-18
View File
@@ -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`,
},
}
})
},
}
-16
View File
@@ -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 />
-18
View File
@@ -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`,
},
}
})
},
}
-6
View File
@@ -1,6 +0,0 @@
# 接入 302.AI 的模型
打开 WebUI 页面,添加模型时选择[302.AI](https://share.302.ai/SuTG99)即可
![model](/assets/image/zh/workshop/302ai-integration/model.png)
@@ -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.
![Download Release](/assets/image/zh/deploy/langbot/manual/dl_release.png)
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.
![Download Release](/images/zh/deploy/langbot/manual/dl_release.png)
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.
![Install 1Panel](/assets/image/zh/deploy/langbot/one-click/1p_install_01.png)
![Install 1Panel](/images/zh/deploy/langbot/one-click/1p_install_01.png)
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.
![Install LangBot ](/assets/image/zh/deploy/langbot/one-click/1p_langbot_01.png)
![Install LangBot ](/images/zh/deploy/langbot/one-click/1p_langbot_01.png)
Check the box for `External Port Access` and click Confirm.
![Install LangBot ](/assets/image/zh/deploy/langbot/one-click/1p_langbot_02.png)
![Install LangBot ](/images/zh/deploy/langbot/one-click/1p_langbot_02.png)
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.
![View LangBot Container Information](/assets/image/zh/deploy/langbot/one-click/1p_langbot_03.png)
![View LangBot Container Information](/images/zh/deploy/langbot/one-click/1p_langbot_03.png)
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.
![Install aaPanel](/assets/image/zh/deploy/langbot/one-click/bt_install_01.png)
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.
![aaPanel Access Address](/assets/image/zh/deploy/langbot/one-click/bt_install_02.png)
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`.
![Create LangBot Container](/assets/image/zh/deploy/langbot/one-click/bt_langbot_01.png)
Click the red circle in the image above to view the running logs.
![View LangBot Container Logs](/assets/image/zh/deploy/langbot/one-click/bt_langbot_02.png)
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.
![Install aaPanel](/images/zh/deploy/langbot/one-click/bt_install_01.png)
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.
![aaPanel Access Address](/images/zh/deploy/langbot/one-click/bt_install_02.png)
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`.
![Create LangBot Container](/images/zh/deploy/langbot/one-click/bt_langbot_01.png)
Click the red circle in the image above to view the running logs.
![View LangBot Container Logs](/images/zh/deploy/langbot/one-click/bt_langbot_02.png)
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.
@@ -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
+5
View File
@@ -0,0 +1,5 @@
---
title: "Component Architecture"
---
![Component Architecture Diagram](/images/zh/develop/comp_arch/develop_comp_arch_1.png)
@@ -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,10 @@ 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
@@ -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: [![Discord](https://img.shields.io/discord/1335141740050649118?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb)](https://discord.gg/wdNEHETs87)
Join our community on Discord: [![Discord](https://img.shields.io/discord/1335141740050649118?logo=discord&labelColor=%20%235462eb&logoColor=%20%23f5f5f5&color=%20%235462eb)](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.
@@ -69,15 +71,14 @@ For platform-specific feature support, please check [this document](/en/insight/
## Case Screenshots
![bot_page](/assets/image/zh/insight/features/bot-page.png)
![bot_page](/images/zh/insight/features/bot-page.png)
![create_model](/assets/image/zh/insight/features/create-model.png)
![create_model](/images/zh/insight/features/create-model.png)
![edit_pipeline](/assets/image/zh/insight/features/edit-pipeline.png)
![edit_pipeline](/images/zh/insight/features/edit-pipeline.png)
![plugin_market](/assets/image/zh/insight/features/plugin-market.png)
![plugin_market](/images/zh/insight/features/plugin-market.png)
![private_chat](/assets/image/zh/insight/private_chat.png)
![group_chat](/assets/image/zh/insight/group_chat.png)
![private_chat](/images/zh/insight/private_chat.png)
![group_chat](/images/zh/insight/group_chat.png)
@@ -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
@@ -1,4 +1,6 @@
# Platform Feature Support
---
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.
@@ -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).
+91
View 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:
![](/images/zh/plugin/dev/apis/plugin_dev_messages_01.png)
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.
@@ -61,7 +59,7 @@ class GroupMessageReceived(BaseEventModel):
"""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).
@@ -134,11 +132,11 @@ class GroupNormalMessageReceived(BaseEventModel):
"""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.
@@ -189,7 +187,6 @@ class GroupCommandSent(BaseEventModel):
is_admin: bool
"""Whether it's an administrator"""
```
### NormalMessageResponded
@@ -288,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
@@ -311,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,4 +1,6 @@
# Adding Components
---
title: "Adding Components"
---
Plugins consist of one or more components that provide different functionalities to LangBot. Currently supported component types include:
@@ -31,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.">
```
.
@@ -61,13 +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)
- [KnowledgeRetriever](./knowledge-retriever.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)
@@ -1,8 +1,10 @@
# Component: Knowledge Retriever
---
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="/assets/image/zh/plugin/dev/components/knowledge_retriever_use.png" />
<img width="600" src="/images/zh/plugin/dev/components/knowledge_retriever_use.png" />
## Adding a Knowledge Retriever Component
@@ -116,7 +118,7 @@ For configuration item format reference, see: [Plugin Manifest Configuration For
## 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).
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.
@@ -259,6 +261,6 @@ After creation, execute the command `lbp run` in the plugin directory to start d
2. Add an external knowledge base
3. Select the knowledge retriever provided by your plugin and fill in the configuration
<img width="600" src="/assets/image/zh/plugin/dev/components/knowledge_retriever_config.png" />
<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).
@@ -1,4 +1,6 @@
# Code Style Guide
---
title: "Code Style Guide"
---
## Logging
@@ -12,4 +14,4 @@ logger = logging.getLogger(__name__) # Import logging module at the beginning o
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,10 @@ 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
@@ -73,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:
@@ -91,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.
@@ -109,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.
@@ -123,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
@@ -22,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
@@ -40,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.
![create_api_key](/assets/image/zh/api/create_api_key.png)
![create_api_key](/images/zh/api/create_api_key.png)
After creation, copy the API Key and save it.
![copy_api_key](/assets/image/zh/api/copy_api_key.png)
![copy_api_key](/images/zh/api/copy_api_key.png)
## Use API
@@ -1,4 +1,6 @@
# Webhooks
---
title: "Webhooks"
---
Webhooks allow you to send bot message events to external services for processing.
@@ -85,9 +87,9 @@ Webhook services should return JSON:
- `true`: Message won't continue in pipeline
- `false`: Message proceeds normally
::: tip
<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
@@ -1,17 +1,20 @@
# Using the Knowledge Base
---
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>
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`.
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="/assets/image/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
<img width="400px" src="/images/zh/deploy/knowledge/upload_docs.png" alt="create_kb" />
## Connect External Knowledge Base
@@ -21,14 +24,14 @@ On the knowledge base page, switch to the "External Knowledge Base" tab and add
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="/assets/image/zh/deploy/knowledge/use_local_agent.png" alt="use_kb" />
<img width="400px" src="/images/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" />
<img width="400px" src="/images/zh/deploy/knowledge/use_kb.png" alt="use_kb" />
:::info
<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="/assets/image/zh/deploy/knowledge/use_kb_in_chat.png" alt="use_kb_in_chat" />
<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 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 supports HTTP Streamable, SSE and stdio modes.
<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" />
@@ -1,10 +1,12 @@
# Configure Models (Models)
---
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="/assets/image/zh/deploy/models/langbot_models.png" alt="langbot_models" />
<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).
@@ -16,11 +18,11 @@ You can also add models from other sources.
Models will be used by pipelines to process messages. The first model you configure will be set as the model for the default pipeline.
![arch](/assets/image/zh/deploy/models/arch.png)
![arch](/images/zh/deploy/models/arch.png)
You can add multiple models, and then select which model to use in the pipeline.
<img width="400px" src="/assets/image/zh/deploy/models/model_config.png" alt="model_config" />
<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.
@@ -34,7 +36,7 @@ For model capabilities, please choose according to the specific model characteri
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="/assets/image/zh/deploy/models/embedding_model.png" alt="embedding_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.
@@ -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.
![Coze Application API Key](/assets/image/zh/deploy/pipelines/coze/coze07.png)
![Coze Application API Key](/images/zh/deploy/pipelines/coze/coze07.png)
2. In "API Management", create and copy the token.
![Coze Application API Key](/assets/image/zh/deploy/pipelines/coze/coze06.png)
![Coze Application API Key](/images/zh/deploy/pipelines/coze/coze06.png)
:::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`.
![Coze bot_id](/assets/image/zh/deploy/pipelines/coze/coze05.png)
![Coze bot_id](/images/zh/deploy/pipelines/coze/coze05.png)
* Make sure to select the API option when publishing the agent
![Coze Application API Key](/assets/image/zh/deploy/pipelines/coze/coze04.png)
![Coze Application API Key](/images/zh/deploy/pipelines/coze/coze04.png)
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`
![Pipeline Configuration](/assets/image/zh/deploy/pipelines/coze/coze08.png)
![Pipeline Configuration](/images/zh/deploy/pipelines/coze/coze08.png)
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/usage/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.
![Dify Application API Key](/assets/image/zh/deploy/pipelines/dify/dify_sv_api_01.png)
![Dify Application API Key](/images/zh/deploy/pipelines/dify/dify_sv_api_01.png)
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.
![Setting Development Item](/assets/image/zh/deploy/pipelines/dify/dify_sv_api_02.png)
![Setting Development Item](/images/zh/deploy/pipelines/dify/dify_sv_api_02.png)
::: 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.
![Dify Workflow Application Output Key](/assets/image/zh/deploy/pipelines/dify/dify_workflow_output_key.png)
![Dify Workflow Application Output Key](/images/zh/deploy/pipelines/dify/dify_workflow_output_key.png)
## 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:
![create_flow](/assets/image/zh/deploy/pipelines/langflow/create_flow.png)
![create_flow](/images/zh/deploy/pipelines/langflow/create_flow.png)
You can modify the workflow according to your needs:
![edit_flow](/assets/image/zh/deploy/pipelines/langflow/edit_flow.png)
![edit_flow](/images/zh/deploy/pipelines/langflow/edit_flow.png)
## 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.
![set_langflow_runner](/assets/image/zh/deploy/pipelines/langflow/set_langflow_runner.png)
![set_langflow_runner](/images/zh/deploy/pipelines/langflow/set_langflow_runner.png)
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:
![get_api_key](/assets/image/zh/deploy/pipelines/langflow/get_api_key.png)
![get_api_key](/images/zh/deploy/pipelines/langflow/get_api_key.png)
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:
![get_flow_id](/assets/image/zh/deploy/pipelines/langflow/get_flow_id.png)
![get_flow_id](/images/zh/deploy/pipelines/langflow/get_flow_id.png)
@@ -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`.
![n8n as the runner](/assets/image/zh/deploy/pipelines/n8n/config_runner.png)
![n8n as the runner](/images/zh/deploy/pipelines/n8n/config_runner.png)
Then configure and fill in the other settings according to the content below.
## Configuring n8n Workflow Connection
![n8n Workflow](/assets/image/zh/deploy/pipelines/n8n/create_wf.png)
![n8n Workflow](/images/zh/deploy/pipelines/n8n/create_wf.png)
or
![n8n Workflow](/assets/image/zh/deploy/pipelines/n8n/create_wf01.png)
![n8n Workflow](/images/zh/deploy/pipelines/n8n/create_wf01.png)
Select `Webhook` or `On chat message` as the trigger and configure as follows:
- Webhook:
![n8n webhook configuration](/assets/image/zh/deploy/pipelines/n8n/config_webhook.png)
![n8n webhook configuration](/images/zh/deploy/pipelines/n8n/config_webhook.png)
- On chat message:
![n8n on chat message configuration](/assets/image/zh/deploy/pipelines/n8n/config_n8n_onchatmessage.png)
![n8n on chat message configuration](/images/zh/deploy/pipelines/n8n/config_n8n_onchatmessage.png)
:::info
If you need streaming responses, set `Response Mode` to `Streaming`.
![n8n streaming configuration](/assets/image/zh/deploy/pipelines/n8n/config_response_model.png)
:::
<Info title="If you need streaming responses, set `Response Mode` to `Streaming`.">
![n8n streaming configuration](/images/zh/deploy/pipelines/n8n/config_response_model.png)
</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.">
![n8n workflow configuration](/assets/image/zh/deploy/pipelines/n8n/config_auth.png)
:::
![n8n workflow configuration](/images/zh/deploy/pipelines/n8n/config_auth.png)
</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.
![n8n AI model call configuration](/assets/image/zh/deploy/pipelines/n8n/config_call_ai.png)
![n8n AI model call configuration](/images/zh/deploy/pipelines/n8n/config_call_ai.png)
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):
![n8n workflow response configuration](/assets/image/zh/deploy/pipelines/n8n/config_respond.png)
![n8n workflow response configuration](/images/zh/deploy/pipelines/n8n/config_respond.png)
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.
![arch](/assets/image/zh/deploy/pipelines/arch.png)
![arch](/images/zh/deploy/pipelines/arch.png)
You can create multiple pipelines for different bots to adapt to different scenarios.
@@ -20,13 +22,13 @@ 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.
*<!-- ![edit_pipeline](/assets/image/zh/deploy/pipelines/edit_pipeline_ai.png) -->*
{/* ![edit_pipeline](/images/zh/deploy/pipelines/edit_pipeline_ai.png) */}
<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/usage/pipelines/dify.html).
- For detailed steps on connecting to n8n, you can [refer to the tutorial](/en/usage/pipelines/n8n.html).
@@ -46,7 +48,7 @@ When using external LLMOps platforms, LangBot explicitly passes the following pa
You can [customize any variable through plugins](/en/plugin/dev/apis/common.html#set-request-variables).
![Dify Workflow Start Node Configuration](/assets/image/zh/workshop/dify-service-api/dify_workflow_var.png)
![Dify Workflow Start Node Configuration](/images/zh/workshop/dify-service-api/dify_workflow_var.png)
## Other Configurations
@@ -1,56 +1,58 @@
# Deploy DingTalk Bot
---
title: "Deploy DingTalk Bot"
---
Deploy LangBot to DingTalk.
## Create Bot
Enter the [DingTalk Developer Backend](https://open-dev.dingtalk.com/?spm=ding_open_doc.document.0.0.74f445e5MkawbT#/), log in and enter the organization. After successful login, enter the open platform, which looks like this:
![DingTalk Open Platform](/assets/image/zh/deploy/bots/dingtalk/dingtalk1.png)
![DingTalk Open Platform](/images/zh/deploy/bots/dingtalk/dingtalk1.png)
Click `Application Development` at the top, then click the blue button `Create Application` on the right, fill in the basic information of the bot, and click save.
Enter the bot's backend, for example, if we have a bot named langbot2, its management page looks like this:
![Bot Page](/assets/image/zh/deploy/bots/dingtalk/dingtalk2.png)
![Bot Page](/images/zh/deploy/bots/dingtalk/dingtalk2.png)
## Configure Bot
Click `Add Application Capability`, `Other Application Capabilities`, `Configure` in `Robot`, click configure and fill in the information, as shown below:
![Bot Configuration](/assets/image/zh/deploy/bots/dingtalk/dingtalk3.png)
![Bot Configuration](/images/zh/deploy/bots/dingtalk/dingtalk3.png)
Click `Publish` at the bottom of the page, after successful publication, click `Version Management and Publishing` at the bottom left of the bot page, as shown:
![Version Management and Publishing](/assets/image/zh/deploy/bots/dingtalk/dingtalk4.png)
![Version Management and Publishing](/images/zh/deploy/bots/dingtalk/dingtalk4.png)
If this is the first time creating a bot, the right side is empty, you need to click `Create New Version`, set information in it, then set `Application Visibility Range`, and click save.
Click `Event Subscription`, change the push method to `Stream Mode Push`.
If card streaming is needed, you must apply for card permissions in the permission management, as shown:
![Before applying for card permissions](/assets/image/zh/deploy/bots/dingtalk/dingtalk6.png)
![Before applying for card permissions](/images/zh/deploy/bots/dingtalk/dingtalk6.png)
![After applying for card permissions](/assets/image/zh/deploy/bots/dingtalk/dingtalk7.png)
![After applying for card permissions](/images/zh/deploy/bots/dingtalk/dingtalk7.png)
Additionally, for card messages you mainly need to create a card template and record the template ID to fill in the configuration, the process is as follows:
> The card content template ID can be obtained by logging into the developer backend > [Card Platform](https://open-dev.dingtalk.com/fe/card?spm=ding_open_doc.document.0.0.33cf2281L0fXsV)
Fill in information when creating a new template, as shown:
![Fill in information for new template](/assets/image/zh/deploy/bots/dingtalk/dingtalk8.png)
![Fill in information for new template](/images/zh/deploy/bots/dingtalk/dingtalk8.png)
Select a preset template (just choose the first one and modify the template content later), as shown:
![Select preset template](/assets/image/zh/deploy/bots/dingtalk/dingtalk9.png)
![Select preset template](/images/zh/deploy/bots/dingtalk/dingtalk9.png)
Click Use
![Click](/assets/image/zh/deploy/bots/dingtalk/dingtalk10.png)
![Click](/images/zh/deploy/bots/dingtalk/dingtalk10.png)
Create
![Create](/assets/image/zh/deploy/bots/dingtalk/dingtalk11.png)
![Create](/images/zh/deploy/bots/dingtalk/dingtalk11.png)
After clicking Create you'll be redirected to edit the template. As shown, you can freely edit your desired card message:
![Edit template](/assets/image/zh/deploy/bots/dingtalk/dingtalk12.png)
![Edit template](/images/zh/deploy/bots/dingtalk/dingtalk12.png)
For the main content, keep the default 'content' unchanged:
![Don't modify](../../../assets/image/zh/deploy/bots/dingtalk/dingtalk13.png)
![Don't modify](../../../images/zh/deploy/bots/dingtalk/dingtalk13.png)
After editing and confirming everything is correct, save it and copy the template ID to fill in the configuration file:
![Save](../../../assets/image/zh/deploy/bots/dingtalk/dingtalk14.png)
![Copy template ID](../../../assets/image/zh/deploy/bots/dingtalk/dingtalk15.png)
![Save](../../../images/zh/deploy/bots/dingtalk/dingtalk14.png)
![Copy template ID](../../../images/zh/deploy/bots/dingtalk/dingtalk15.png)
## Fill in Configuration Information
@@ -61,17 +63,17 @@ Record the above configuration items and fill them in the LangBot bot configurat
Click [Card Platform](https://open-dev.dingtalk.com/fe/card?spm=ding_open_doc.document.0.0.33cf2281L0fXsV), copy the corresponding bound template ID from the template list, and fill it into the card template ID field.
![Connect to LangBot](/assets/image/zh/deploy/bots/dingtalk/connect_to_langbot.png)
![Connect to LangBot](/images/zh/deploy/bots/dingtalk/connect_to_langbot.png)
Streaming related:
![img.png](../../../assets/image/zh/deploy/bots/lark/lark_15.png)
![img.png](../../../images/zh/deploy/bots/lark/lark_15.png)
**Start LangBot**.
## Add Bot
This article uses DingTalk Windows desktop version as an example, click `Search` at the top, `Features`, then enter the name of the bot you just created, as shown:
![robot_png](/assets/image/zh/deploy/bots/dingtalk/dingtalk5.png)
![robot_png](/images/zh/deploy/bots/dingtalk/dingtalk5.png)
Click on the bot to chat with it.
@@ -1,22 +1,24 @@
# Connect to Discord Bot
---
title: "Connect to Discord Bot"
---
## Create Bot
Go to the [Discord Developer Portal](https://discord.com/developers/applications), log in, and create an application.
![alt text](/assets/image/zh/deploy/bots/discord/discord_01.png)
![alt text](/images/zh/deploy/bots/discord/discord_01.png)
Modify the basic information, click `Save Changes` to save.
![alt text](/assets/image/zh/deploy/bots/discord/discord_02.png)
![alt text](/images/zh/deploy/bots/discord/discord_02.png)
Click `Bot` on the left, click `Reset Token`, copy the generated Token.
![alt text](/assets/image/zh/deploy/bots/discord/discord_03.png)
![alt text](/images/zh/deploy/bots/discord/discord_03.png)
And check all options in `Privileged Gateway Intents` on this page, click `Save Changes` to save.
![alt text](/assets/image/zh/deploy/bots/discord/discord_05.png)
![alt text](/images/zh/deploy/bots/discord/discord_05.png)
**Finally, click `OAuth2` on the left, copy the `Client ID` on the page.**
@@ -24,13 +26,11 @@ And check all options in `Privileged Gateway Intents` on this page, click `Save
Click to add a new bot, fill in the `Client ID` and `Token` obtained in the previous step into the configuration.
![alt text](/assets/image/zh/deploy/bots/discord/connect_to_langbot.png)
![alt text](/images/zh/deploy/bots/discord/connect_to_langbot.png)
:::warning
<Warning title="If you are using this adapter within mainland China, you may need to set up a network proxy.">
If you are using this adapter within mainland China, you may need to set up a network proxy.
:::
</Warning>
After filling in, start LangBot. If configured successfully, the log will show `[02-02 16:48:15.263] manager.py (68) - [INFO] : Initializing platform adapter 1: discord`, keep LangBot running.
@@ -40,16 +40,16 @@ You need to create a server first, then invite the bot to the server.
Go to the `OAuth2` page, select `URL Generator`, select `bot`, check the permissions as shown in the image.
![alt text](/assets/image/zh/deploy/bots/discord/discord_06.png)
![alt text](/images/zh/deploy/bots/discord/discord_06.png)
![alt text](/assets/image/zh/deploy/bots/discord/discord_07.png)
![alt text](/images/zh/deploy/bots/discord/discord_07.png)
Click `Copy`, paste the generated URL into your browser to open it, and invite the bot to your server.
![alt text](/assets/image/zh/deploy/bots/discord/discord_08.png)
![alt text](/images/zh/deploy/bots/discord/discord_08.png)
## Use Bot
Now you can use the bot normally in groups or private messages.
![alt text](/assets/image/zh/deploy/bots/discord/discord_09.png)
![alt text](/images/zh/deploy/bots/discord/discord_09.png)
@@ -1,62 +1,64 @@
# Integrating KOOK Bot
---
title: "Integrating KOOK Bot"
---
## Create a Bot
Visit the [KOOK Developer Center](https://developer.kookapp.cn/), log in and access the console.
![KOOK Developer Console](/assets/image/zh/deploy/bots/kook/01-dashboard.png)
![KOOK Developer Console](/images/zh/deploy/bots/kook/01-dashboard.png)
Click "Create Application" and fill in the application information.
![Create Application](/assets/image/zh/deploy/bots/kook/02-create-app.png)
![Create Application](/images/zh/deploy/bots/kook/02-create-app.png)
After the application is created, enter the application details page.
![Application Created](/assets/image/zh/deploy/bots/kook/03-app-created.png)
![Application Created](/images/zh/deploy/bots/kook/03-app-created.png)
You can view the basic information of the application on the application overview page.
![Application Overview](/assets/image/zh/deploy/bots/kook/04-app-overview.png)
![Application Overview](/images/zh/deploy/bots/kook/04-app-overview.png)
## Get Bot Token
In the application page, click the "Bot" tab, copy the Bot Token and save it securely. You will need it later.
![Get Bot Token](/assets/image/zh/deploy/bots/kook/05-bot-token.png)
![Get Bot Token](/images/zh/deploy/bots/kook/05-bot-token.png)
## Configure Bot Permissions
**Important:** In the "Bot" settings, find the "Message Filtering" option and click to configure.
![Message Filter Settings](/assets/image/zh/deploy/bots/kook/07-message-filters.png)
![Message Filter Settings](/images/zh/deploy/bots/kook/07-message-filters.png)
Enable all message-related event permissions, including channel messages and private message events. Otherwise, the bot will not be able to receive messages.
![Enable Permissions](/assets/image/zh/deploy/bots/kook/08-permissions-enabled.png)
![Enable Permissions](/images/zh/deploy/bots/kook/08-permissions-enabled.png)
## Invite the Bot
In the bot settings page, you can generate an invitation link to invite the bot to your server.
![Generate Invitation Link](/assets/image/zh/deploy/bots/kook/06-invite-link.png)
![Generate Invitation Link](/images/zh/deploy/bots/kook/06-invite-link.png)
## Connect to LangBot
Open the LangBot Webui page, and click to create a new bot on the "Bots" page.
![LangBot Bot Management](/assets/image/zh/deploy/bots/kook/09-langbot-bots.png)
![LangBot Bot Management](/images/zh/deploy/bots/kook/09-langbot-bots.png)
Select the KOOK platform, fill in the bot name and Bot Token.
![Configure KOOK Bot](/assets/image/zh/deploy/bots/kook/10-bot-config.png)
![Configure KOOK Bot](/images/zh/deploy/bots/kook/10-bot-config.png)
After saving, the bot will appear in the list.
![Bot Created](/assets/image/zh/deploy/bots/kook/11-bot-created.png)
![Bot Created](/images/zh/deploy/bots/kook/11-bot-created.png)
Click the enable button to start the bot. If successfully configured, the bot status will show as running.
![Bot Enabled](/assets/image/zh/deploy/bots/kook/12-bot-enabled.png)
![Bot Enabled](/images/zh/deploy/bots/kook/12-bot-enabled.png)
## Using the Bot
@@ -1,33 +1,35 @@
# Connect to Feishu Bot
---
title: "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 or store application. [(difference introduction)](https://open.feishu.cn/document/platform-overveiw/overview)
![alt text](/assets/image/zh/deploy/bots/lark/lark_01.png)
![alt text](/images/zh/deploy/bots/lark/lark_01.png)
![alt text](/assets/image/zh/deploy/bots/lark/lark_02.png)
![alt text](/images/zh/deploy/bots/lark/lark_02.png)
Add bot capability to the application:
![alt text](/assets/image/zh/deploy/bots/lark/lark_03.png)
![alt text](/images/zh/deploy/bots/lark/lark_03.png)
Add the permissions shown in the image in the permission management:
![alt text](/assets/image/zh/deploy/bots/lark/lark_04.png)
![alt text](/images/zh/deploy/bots/lark/lark_04.png)
If card streaming permissions are required, additionally add the following card creation and update permissions as shown in the image:
![img_1.png](../../../assets/image/zh/deploy/bots/lark/lark_14.png)
![img_1.png](../../../images/zh/deploy/bots/lark/lark_14.png)
::: warning
<Warning>
If you need to change the default card template, you need to modify the card template in the platform adapter's code yourself.
:::
</Warning>
## Connect to LangBot
Find `app_id` and `app_secret` on the `Credentials and Basic Information` page.
![alt text](/assets/image/zh/deploy/bots/lark/lark_05.png)
![alt text](/images/zh/deploy/bots/lark/lark_05.png)
@@ -35,56 +37,54 @@ Open LangBot's Webui configuration page, create a new bot
Fill in the relevant information in the form
![alt text](/assets/image/zh/deploy/bots/lark/connect_to_langbot.png)
![alt text](/images/zh/deploy/bots/lark/connect_to_langbot.png)
Streaming related:
![Streaming related](../../../assets/image/zh/deploy/bots/lark/connect_to_langbot01.png)
![Streaming related](../../../images/zh/deploy/bots/lark/connect_to_langbot01.png)
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:
<Warning title="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.
:::
</Warning>
## Configure Event Subscription
Go to the `Events and Callbacks` page, configure the subscription method as `Long Connection`:
![alt text](/assets/image/zh/deploy/bots/lark/lark_07.png)
![alt text](/images/zh/deploy/bots/lark/lark_07.png)
And add the event: `Receive Messages`
![alt text](/assets/image/zh/deploy/bots/lark/lark_08.png)
![alt text](/images/zh/deploy/bots/lark/lark_08.png)
:::warning
Webhook mode configuration method:
<Warning title="Webhook mode configuration method:">
![alt text](/assets/image/zh/deploy/bots/lark/lark_13.png)
![alt text](/images/zh/deploy/bots/lark/lark_13.png)
Please start LangBot first, fill in your server address and port here, the path is `/lark/callback`, click `Save`.
:::
</Warning>
## Publish Bot
Click `Create Version` at the top, fill in the version number and other information, click `Save` below.
![alt text](/assets/image/zh/deploy/bots/lark/lark_09.png)
![alt text](/images/zh/deploy/bots/lark/lark_09.png)
Add the bot to a Feishu group to use it:
![alt text](/assets/image/zh/deploy/bots/lark/lark_10.png)
![alt text](/images/zh/deploy/bots/lark/lark_10.png)
![alt text](/assets/image/zh/deploy/bots/lark/lark_11.png)
![alt text](/images/zh/deploy/bots/lark/lark_11.png)
Private chat can also be used directly
![alt text](/assets/image/zh/deploy/bots/lark/lark_12.png)
![alt text](/images/zh/deploy/bots/lark/lark_12.png)
## Common Issues
- Store app bots cannot respond to chat messages immediately after creation/saving. Due to the [app_ticket event](https://open.feishu.cn/document/server-docs/application-v6/event/app_ticket-events) delay mechanism, you need to wait about 2 minutes before it can work normally.
- Store app bots cannot respond to chat messages immediately after creation/saving. Due to the [app_ticket event](https://open.feishu.cn/document/server-docs/application-v6/event/app_ticket-events) delay mechanism, you need to wait about 2 minutes before it can work normally.
@@ -1,4 +1,6 @@
# Integrating LINE Bot
---
title: "Integrating LINE Bot"
---
This article explains how to connect LangBot with the LINE platform to implement LINE bot functionality.
@@ -14,29 +16,29 @@ This article explains how to connect LangBot with the LINE platform to implement
> [Developer Console](https://developers.line.biz/console)
1. In the developer console, create a new Provider (if you don't have one)
![alt text](/assets/image/zh/deploy/bots/line/line01.png)
![alt text](/images/zh/deploy/bots/line/line01.png)
2. Under the Provider, click "Create"
![alt text](/assets/image/zh/deploy/bots/line/line02.png)
![alt text](/images/zh/deploy/bots/line/line02.png)
3. Enter a name and click Create
![alt text](/assets/image/zh/deploy/bots/line/line03.png)
![alt text](/images/zh/deploy/bots/line/line03.png)
4. After being redirected, select Create a Message API
![alt text](/assets/image/zh/deploy/bots/line/line04.png)
![alt text](/images/zh/deploy/bots/line/line04.png)
* Continue by clicking Create a Message API
![alt text](/assets/image/zh/deploy/bots/line/line05.png)
![alt text](/images/zh/deploy/bots/line/line05.png)
* After being redirected, fill in the basic information
![alt text](/assets/image/zh/deploy/bots/line/line06.png)
![alt text](/images/zh/deploy/bots/line/line06.png)
- Channel Name
- Channel Description
- Category
- Subcategory
- Email Address
5. After filling in all information, click "Continue" to create
![alt text](/assets/image/zh/deploy/bots/line/line07.png)
![alt text](/images/zh/deploy/bots/line/line07.png)
6. Check the information you entered, and if there are no issues, click Submit
![alt text](/assets/image/zh/deploy/bots/line/line08.png)
![alt text](/images/zh/deploy/bots/line/line08.png)
7. Successfully created, proceed to use
![alt text](/assets/image/zh/deploy/bots/line/line09.png)
![alt text](/images/zh/deploy/bots/line/line09.png)
### Get Configuration Information
@@ -45,74 +47,74 @@ After creation, you will obtain the following important information, please reco
1. Channel Secret
> [Page after clicking use](https://manager.line.biz/account)
* Select Settings
![alt text](/assets/image/zh/deploy/bots/line/line09.png)
![alt text](/images/zh/deploy/bots/line/line09.png)
* Click Message API
![alt text](/assets/image/zh/deploy/bots/line/line11.png)
![alt text](/images/zh/deploy/bots/line/line11.png)
* Enable Message API
![alt text](/assets/image/zh/deploy/bots/line/line12.png)
![alt text](/images/zh/deploy/bots/line/line12.png)
* Select the Provider you just created and click Agree
![alt text](/assets/image/zh/deploy/bots/line/line13.png)
![alt text](/images/zh/deploy/bots/line/line13.png)
* For privacy terms, simply click OK
![alt text](/assets/image/zh/deploy/bots/line/line14.png)
![alt text](/images/zh/deploy/bots/line/line14.png)
* Click OK to complete creation
![alt text](/assets/image/zh/deploy/bots/line/line15.png)
![alt text](/images/zh/deploy/bots/line/line15.png)
* Copy it
![alt text](/assets/image/zh/deploy/bots/line/line16.png)
![alt text](/images/zh/deploy/bots/line/line16.png)
2. Channel Access Token (need to click the "Issue" button to generate)
* Click console or directly visit [Console](https://developers.line.biz/console/)
![alt text](/assets/image/zh/deploy/bots/line/line17.png)
![alt text](/images/zh/deploy/bots/line/line17.png)
* Select the Provider you created and click Message API
![alt text](/assets/image/zh/deploy/bots/line/line18.png)
![alt text](/images/zh/deploy/bots/line/line18.png)
* Click Message API
![alt text](/assets/image/zh/deploy/bots/line/line19.png)
![alt text](/images/zh/deploy/bots/line/line19.png)
* Scroll to the bottom, click Issue
![alt text](/assets/image/zh/deploy/bots/line/line20.png)
![alt text](/images/zh/deploy/bots/line/line20.png)
* Click the icon to copy
![alt text](/assets/image/zh/deploy/bots/line/line21.png)
![alt text](/images/zh/deploy/bots/line/line21.png)
## Connecting to LangBot
Next, open the LangBot configuration page:
1. Click "Bots", then click "Add"
![alt text](/assets/image/zh/deploy/bots/line/line26.png)
![alt text](/images/zh/deploy/bots/line/line26.png)
2. Select "LINE" in "Platform/Adapter Selection"
![alt text](/assets/image/zh/deploy/bots/line/line27.png)
![alt text](/images/zh/deploy/bots/line/line27.png)
3. Fill in the configuration information:
- Channel Secret: The Channel secret you obtained earlier
- Channel Access Token: The Channel access token you obtained earlier
![alt text](/assets/image/zh/deploy/bots/line/line28.png)
![alt text](/images/zh/deploy/bots/line/line28.png)
4. Click "Save" to complete the configuration
![alt text](/assets/image/zh/deploy/bots/line/line29.png)
![alt text](/images/zh/deploy/bots/line/line29.png)
## Configure Webhook
::: info
<Info>
We recommend that you first refer to [Configure HTTP Reverse Proxy](/en/workshop/production/proxy-and-ssl) to configure the LangBot callback address.
:::
</Info>
* Get the Webhook callback URL from the LangBot configuration page
![alt text](/assets/image/zh/deploy/bots/line/line30.png)
![alt text](/images/zh/deploy/bots/line/line30.png)
* Click console or directly visit [Console](https://developers.line.biz/console/)
![alt text](/assets/image/zh/deploy/bots/line/line17.png)
![alt text](/images/zh/deploy/bots/line/line17.png)
* Select the Provider you created and click Message API
![alt text](/assets/image/zh/deploy/bots/line/line18.png)
![alt text](/images/zh/deploy/bots/line/line18.png)
* Click Message API
![alt text](/assets/image/zh/deploy/bots/line/line19.png)
![alt text](/images/zh/deploy/bots/line/line19.png)
* Click Edit to fill in the connection
![alt text](/assets/image/zh/deploy/bots/line/line22.png)
![alt text](/images/zh/deploy/bots/line/line22.png)
* Enter the connection (must be an HTTPS connection, which means you need an SSL certificate), click Update
![alt text](/assets/image/zh/deploy/bots/line/line23.png)
![alt text](/images/zh/deploy/bots/line/line23.png)
* Select Use Webhook
![alt text](/assets/image/zh/deploy/bots/line/line24.png)
![alt text](/images/zh/deploy/bots/line/line24.png)
5. Click the "Verify" button to test if the connection is successful
![alt text](/assets/image/zh/deploy/bots/line/line25.png)
![alt text](/images/zh/deploy/bots/line/line25.png)
## Feature Configuration
@@ -1,12 +1,14 @@
# Deploy Message Platform Lagrange
---
title: "Deploy Message Platform Lagrange"
---
## Lagrange Introduction
Lagrange is a QQNT protocol reverse engineering framework that is lightweight and relatively stable. Connect through the OneBot 11 protocol, you need to select `OneBot v11` as the adapter.
::: warning
<Warning>
You need to use NT QQ to interact with the bot, old versions of QQ will not work properly
:::
</Warning>
## Deployment Steps
@@ -24,11 +26,11 @@ You need to log in to Github to download. If you don't need certain features, yo
Follow the images to download:
![Image 1](/assets/image/zh/deploy/bots/qq/onebot/lagrange/dl_lgr_1.png)
![Image 1](/images/zh/deploy/bots/qq/onebot/lagrange/dl_lgr_1.png)
![Image 2](/assets/image/zh/deploy/bots/qq/onebot/lagrange/dl_lgr_2.png)
![Image 2](/images/zh/deploy/bots/qq/onebot/lagrange/dl_lgr_2.png)
![Image 3](/assets/image/zh/deploy/bots/qq/onebot/lagrange/dl_lgr_3.png)
![Image 3](/images/zh/deploy/bots/qq/onebot/lagrange/dl_lgr_3.png)
### Final Steps
@@ -46,7 +48,7 @@ If you cannot log in, please check if you have correctly filled in the signature
You need to configure Lagrange to connect to LangBot. Please edit Lagrange's configuration file appsettings.json and ensure that the connection configuration in Implementations matches the content in the image below:
![Configure Connection](/assets/image/zh/deploy/bots/qq/onebot/lagrange/config_lgr.png)
![Configure Connection](/images/zh/deploy/bots/qq/onebot/lagrange/config_lgr.png)
The Type must be `ReverseWebSocket`;
Host is the IP of the host running LangBot, if on the same host, you can write `127.0.0.1`;
@@ -60,8 +62,8 @@ Click on Bots, then click Add
Select `OneBot v11` for `Platform/Adapter Selection`
![napcat_webui_03](/assets/image/zh/deploy/bots/qq/onebot/napcat/napcat_webui_03.png)
![napcat_webui_03](/images/zh/deploy/bots/qq/onebot/napcat/napcat_webui_03.png)
::: info
<Info>
Note, if you have network connection issues involving multiple docker containers, please refer to [Network Configuration Details](/en/workshop/network-details)
:::
</Info>
@@ -1,4 +1,6 @@
# Deploy Message Platform LiteLoaderQQNT
---
title: "Deploy Message Platform LiteLoaderQQNT"
---
Connect through the OneBot 11 protocol, you need to select ``OneBot v11`` as the adapter.
@@ -8,7 +10,7 @@ Connect through the OneBot 11 protocol, you need to select ``OneBot v11`` as the
Installation tutorial for LiteLoaderQQNT: https://llonebot.github.io/zh-CN/guide/getting-started
![Image 1](/assets/image/zh/deploy/bots/qq/onebot/llonebot/llob_cfg.png)
![Image 1](/images/zh/deploy/bots/qq/onebot/llonebot/llob_cfg.png)
Make sure the IP address in the address is the address of the host running LangBot (if running on the same network, use 127.0.0.1)
@@ -20,8 +22,8 @@ Click on Bots, then click Add
Select `OneBot v11` for `Platform/Adapter Selection`
![napcat_webui_03](/assets/image/zh/deploy/bots/qq/onebot/napcat/napcat_webui_03.png)
![napcat_webui_03](/images/zh/deploy/bots/qq/onebot/napcat/napcat_webui_03.png)
::: info
<Info>
Note, if you have network connection issues involving multiple docker containers, please refer to [Network Configuration Details](/en/workshop/network-details)
:::
</Info>
@@ -1,4 +1,6 @@
# Deploy Message Platform NapCat
---
title: "Deploy Message Platform NapCat"
---
Connect through the OneBot 11 protocol, you need to select ``OneBot v11`` as the adapter.
@@ -11,12 +13,12 @@ Follow the [NapCat official documentation for installation](https://napcat.napne
Only using webui operation as an example, for other configuration methods, please check the NapCat documentation.
After logging in, you can check the logs in the console or Bash, find `[NapCat] [WebUi] WebUi Publish Panel Url: http://x.x.x.x:6099/webui?token=xxxxx `
![napcat_webui_01](/assets/image/zh/deploy/bots/qq/onebot/napcat/napcat_webui_01.png)
![napcat_webui_01](/images/zh/deploy/bots/qq/onebot/napcat/napcat_webui_01.png)
Copy the Url to your browser or on Windows 11, press Ctrl and click the Url. After scanning the QR code to log in, you will enter the network configuration page.
Click Add Network Configuration, select WebSocket Client, click Enable, then fill in `ws://127.0.0.1:2280/ws` in the Url field and save.
![napcat_webui_02](/assets/image/zh/deploy/bots/qq/onebot/napcat/napcat_webui_02.png)
![napcat_webui_02](/images/zh/deploy/bots/qq/onebot/napcat/napcat_webui_02.png)
## NapCat Integration
@@ -26,8 +28,8 @@ Click on Bots, then click Add
Select `OneBot v11` for `Platform/Adapter Selection`
![napcat_webui_03](/assets/image/zh/deploy/bots/qq/onebot/napcat/napcat_webui_03.png)
![napcat_webui_03](/images/zh/deploy/bots/qq/onebot/napcat/napcat_webui_03.png)
::: info
<Info>
Note, if you have network connection issues involving multiple docker containers, please refer to [Network Configuration Details](/en/workshop/network-details)
:::
</Info>

Some files were not shown because too many files have changed in this diff Show More