feat: Phase 6.3 视觉理解 — 多模态图片输入 + OCR/Vision 工具 + 图片编码管线

- LLMMessage 新增 Images 字段支持多模态 content array
- OpenAIProvider 支持 image_url content parts
- VisionTool: 图片读取 + base64 编码 + OCR/场景描述/综合分析
- 对话管道全线支持 images 参数传递 (Gateway->Orchestrator->Synthesizer->LLM)
- 自动根据图片有无构建 text-only 或 multimodal content

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 22:28:42 +08:00
parent 38b36fc5ad
commit 9a8fb8d0ce
7 changed files with 205 additions and 24 deletions
@@ -98,7 +98,8 @@ type ProcessParams struct {
UserID string
SessionID string
Message string
Mode string // text / voice_msg / voice_assistant
Images []string // 图片 base64 data URL (多模态)
Mode string // text / voice_msg / voice_assistant
Nickname string
}
@@ -262,6 +263,7 @@ func (o *Orchestrator) ProcessInput(
UserID: params.UserID,
SessionID: params.SessionID,
UserMessage: params.Message,
Images: params.Images,
Nickname: userName,
PersonaPrompt: systemPrompt,
DialogHistory: history,
@@ -25,17 +25,18 @@ func NewSynthesizer(llmAdapter *llm.Adapter) *Synthesizer {
// SynthesizeParams 综合参数
type SynthesizeParams struct {
UserID string
SessionID string
UserMessage string
Nickname string
PersonaPrompt string // 完整人格提示词
DialogHistory []model.LLMMessage // 对话历史
MemorySummary string // 记忆检索摘要
ThoughtOutline string // 通用对话思考
IoTSummary string // IoT 操作摘要
DeviceContext string // 设备状态上下文
Mode string // text / voice_assistant
UserID string
SessionID string
UserMessage string
Images []string // 图片 base64 data URL (多模态)
Nickname string
PersonaPrompt string // 完整人格提示词
DialogHistory []model.LLMMessage // 对话历史
MemorySummary string // 记忆检索摘要
ThoughtOutline string // 通用对话思考
IoTSummary string // IoT 操作摘要
DeviceContext string // 设备状态上下文
Mode string // text / voice_assistant
}
// Synthesize 综合所有子会话结果,流式生成最终回复
@@ -99,10 +100,11 @@ func (s *Synthesizer) buildSynthesizeMessages(params SynthesizeParams) []model.L
messages = append(messages, params.DialogHistory...)
}
// 当前用户消息
// 当前用户消息 (支持多模态图片)
messages = append(messages, model.LLMMessage{
Role: model.RoleUser,
Content: params.UserMessage,
Images: params.Images,
})
return messages