## 概述 v0.4 两个核心目标: 1. **多模态支持** — Message 从纯文本升级为结构化 ContentPart,适配图片输入 2. **gRPC 外部插件骨架** — Guard/PreProcessor/PostProcessor 通过 gRPC 作为独立进程加载,首个外部插件跑通 ## 多模态 ### 数据模型 - [ ] `Message.Content` 从 `string` 改为 `[]ContentPart` 结构 - [ ] `ContentPart` 类型:text / image_url / image_base64 / audio / file - [ ] 向后兼容:纯文本 string 自动转为 `[{type: "text", text: "..."}]` ### Adapter 适配 - [ ] adapter-openai — 透传 image_url(原生兼容) - [ ] adapter-anthropic — image_url 转 base64,content block 格式 - [ ] adapter-ollama — 图片 base64 透传 - [ ] 流式场景下多模态响应处理 ### PreProcessor 扩展 - [ ] image-to-text 插件:图片 → 视觉模型描述 → 注入文本,让纯文本模型间接支持图片理解 ## gRPC 外部插件 ### Proto 定义 - [ ] `api/grpc/plugin.proto` — Guard / PreProcessor / PostProcessor / PluginMeta / Init / Health 服务定义 - [ ] `oneof request` 支持 ChatRequest(未来可扩展 Embedding/Rerank) - [ ] 代码生成:`pb/plugin.pb.go` + `pb/plugin_grpc.pb.go` ### 启动器 - [ ] `internal/plugin/grpc_launcher.go` — 子进程启动,Unix socket 监听 - [ ] `plugins.yaml` 新增 `runtime: grpc` + `command` 字段 - [ ] 启动健康检查(gRPC Health Check) ### Wrapper - [ ] `internal/plugin/grpc_wrapper.go` — 实现 api.Guard / PreProcessor / PostProcessor - [ ] `api/grpc/convert.go` — api.PipelineContext ↔ proto 互转 - [ ] `internal/plugin/grpc_errors.go` — gRPC status → api.PluginError 映射 ### 插件 SDK - [ ] `plugin/sdk/server.go` — `Serve()` 一行启动 gRPC server - [ ] `plugin/sdk/testing.go` — TestHarness 测试工具 ### 连接 - [ ] 单连接(无连接池),后续版本优化 ## 完成标志 - `/v1/chat/completions` 可接收图片输入,OpenAI/Anthropic/Ollama 三个 adapter 均支持多模态 - 首个外部插件通过 `plugins.yaml runtime: grpc` 加载并参与管线执行 ## 设计文档 - [gRPC 插件架构设计](docs/internal/grpc-plugin-design.md) - [内部 Roadmap](docs/internal/roadmap.md)
概述
v0.4 两个核心目标:
多模态
数据模型
Message.Content从string改为[]ContentPart结构ContentPart类型:text / image_url / image_base64 / audio / file[{type: "text", text: "..."}]Adapter 适配
PreProcessor 扩展
gRPC 外部插件
Proto 定义
api/grpc/plugin.proto— Guard / PreProcessor / PostProcessor / PluginMeta / Init / Health 服务定义oneof request支持 ChatRequest(未来可扩展 Embedding/Rerank)pb/plugin.pb.go+pb/plugin_grpc.pb.go启动器
internal/plugin/grpc_launcher.go— 子进程启动,Unix socket 监听plugins.yaml新增runtime: grpc+command字段Wrapper
internal/plugin/grpc_wrapper.go— 实现 api.Guard / PreProcessor / PostProcessorapi/grpc/convert.go— api.PipelineContext ↔ proto 互转internal/plugin/grpc_errors.go— gRPC status → api.PluginError 映射插件 SDK
plugin/sdk/server.go—Serve()一行启动 gRPC serverplugin/sdk/testing.go— TestHarness 测试工具连接
完成标志
/v1/chat/completions可接收图片输入,OpenAI/Anthropic/Ollama 三个 adapter 均支持多模态plugins.yaml runtime: grpc加载并参与管线执行设计文档