Files
admin777 b631acd42e feat: 将插件 stdin 协议定为 v1,并按声明注入凭据
进程外插件改为只读环境变量和自身配置,避免读宿主 appsettings;宿主按 plugin.json 声明注入 LLM / OpenWeather 等凭据。
2026-09-11 10:46:52 +08:00

38 lines
1.2 KiB
Markdown
Raw Permalink 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.
# FileCity 插件
独立进程。宿主只读取本目录的 `plugin.json`,按 `launch` 原样启动,不会替你拼命令。
`protocolVersion` 为 1。LLM 只从环境变量读取(宿主注入),不读宿主 `appsettings.json`
## 输入 / 输出
字段名必须和 `plugin.json` 以及 `Program.cs` 里读写的 JSON 键一致。
- 输入 `filePath`
- 输出 `hasValidCities``cities``reason``raw`
## 凭据
不要把 API Key 写进 `plugin.json` 或流程图。本插件声明需要 `openai-compatible` 凭据。运行时宿主会:
1. 把选中的凭据写入本进程环境变量 `OPENAI_ENDPOINT` / `OPENAI_API_KEY` / `OPENAI_CHAT_MODEL`
2. 通过 stdin JSON 的 `credentials.llm` 再传一份
可选:在本目录放 `.env` 作为插件自己的默认环境(适合第三方自带模型)。节点上选中的宿主凭据会覆盖 `.env` 里的同名变量。
## 协议
stdin
```json
{
"protocolVersion": 1,
"inputs": { "filePath": "Data/cities.txt" },
"credentials": {
"llm": { "id": "llm-default", "type": "openai-compatible", "endpoint": "...", "apiKey": "...", "model": "..." }
}
}
```
stdout:单个 JSON 对象,字段等于 outputs。日志请写 stderr。