Files
LangBot/zh/plugin/dev/components/add.mdx
T
Junyan QinandClaude Opus 4.6 3d1d97ecca docs: add Page component tutorial (zh + en)
Add comprehensive Page component documentation covering:
- Use cases (admin panels, data displays, interactive tools)
- Manifest file format
- Backend handler with PageRequest/PageResponse
- Frontend development with Page SDK (API calls, dark mode, i18n)
- Full FAQ Manager example
- Update add.mdx and docs.json navigation for both languages

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-04-25 21:59:17 +08:00

80 lines
2.1 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "添加组件"
---
插件由一种或多种组件构成,为 LangBot 提供不同的功能。目前支持的组件类型有:
- 事件监听器(EventListener):监听流水线执行期间的事件,对上下文或流水线进行修改。
- 命令(Command):由用户通过`!`(或其他已设置的前缀)开头的命令消息触发。
- 工具(Tool):供 LangBot 内置的 Local Agent 在执行期间由 LLM 调用。
- RAG 引擎(KnowledgeEngine):为 LangBot 提供知识库的索引和检索能力,管理文档摄取、检索和删除。
- 解析器(Parser):在文档摄取前将 PDF、Word 等二进制文件解析为结构化文本,供 RAG 引擎使用。
- 页面(Page):在 LangBot WebUI 侧边栏中注册自定义可视化页面,提供管理面板、数据展示等交互式界面。
## 添加组件
在插件目录下执行命令:
```bash
lbp comp <component_type>
```
例如,添加一个事件监听器:
```bash
lbp comp EventListener
```
请根据提示输入组件的配置(若有)。
```bash
➜ HelloPlugin > lbp comp EventListener
Generating component EventListener...
Component EventListener generated successfully.
组件 EventListener 生成成功。
➜ HelloPlugin >
```
<Info title="">
CLI 将在插件目录下生成一个 `components` 目录,并在其中创建组件对应目录
```
.
├── assets
│   └── icon.svg
├── components
│   ├── __init__.py
│   └── event_listener
│   ├── __init__.py
│   ├── default.py
│   └── default.yaml
├── main.py
├── manifest.yaml
├── README.md
└── requirements.txt
```
同时,会在插件的`manifest.yaml`中添加组件发现配置:
```yaml
...
components:
EventListener:
fromDirs:
- path: components/event_listener/
...
```
如需删除组件,可自行删除对应信息。
</Info>
## 组件类型
各个组件的详细使用方式请参考:
- [EventListener](./event-listener)
- [Command](./command)
- [Tool](./tool)
- [KnowledgeEngine](./knowledge-engine)
- [Parser](./parser)
- [Page](./page)