docs: 插件README+开发文档更新 — 反映自动发现流程(扫描go.mod+plugin.json)
This commit is contained in:
@@ -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` 读取模块路径。
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user