Files
chongming-plugins/README.md
T
2026-07-21 16:14:02 +08:00

20 lines
710 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 插件目录
每个子目录代表一个 Worker 插件,包含以下约定结构:
```text
plugin_name/
├── init.py # 提供 create_workers 和 cleanup 工厂函数
├── router/ # RPC 方法实现(使用 @rpc_method)
├── models/ # 由 gen_models 生成的 Pydantic 模型(自动生成,勿手动修改)
├── global_var.py # 全局状态管理(如数据库连接)
└── README.md # 插件说明
```
## 开发新插件
1. 在 `config/workers/` 下创建同名目录,编写路由 TOML
2. 运行 `uv run gen_models config/workers/<plugin> src/plugins/<plugin>`
3. 实现 `router/*.py` 中的业务逻辑
4. 在 `__init__.py` 中实现 `create_workers` 工厂函数