docs: 插件README+开发文档更新 — 反映自动发现流程(扫描go.mod+plugin.json)

This commit is contained in:
2026-06-25 21:55:44 +08:00
parent 4424c09759
commit 2d79126d36
2 changed files with 37 additions and 29 deletions
+9 -9
View File
@@ -147,20 +147,20 @@ func (t *HelloTool) Complexity() sdk.ToolComplexity { return sdk.ComplexitySimpl
## 注册
1. 将插件代码放`backend/plugins/<插件名>/`
2. `backend/ai-core/plugins.json` 中添加条目
```json
{ "name": "my-hello", "import": "git.yeij.top/AskaEth/Cyrene-Plugins/my-hello", "struct": "HelloPlugin" }
```
3. 运行代码生成器:
1. 将插件目录复制`backend/plugins/`(需包含 `go.mod` + `plugin.json`
2. 运行代码生成器(自动扫描、生成注册代码、补 go.mod)
```bash
cd backend/ai-core/cmd && go run gen_plugins.go
```
4. 重新编译 ai-core。**不需要修改 main.go。**
3. 重新编译 ai-core
```bash
cd backend/ai-core && go build -o main.exe ./cmd/
```
**不需编辑 `plugins.json`,不需修改 `main.go`。** 生成器自动从 `go.mod` 读取模块路径。
---