fix: XML动作标签 + 意图分析上下文 + 图片file_id引用

- 动作消息改用 <action>...</action> XML 标签(注入器 + 解析器 + 测试)
- 括号解析保留为降级方案,确保向后兼容
- 意图分析传入最近对话历史,防止短追问误判为 iot_query
- 意图提示词强化:短追问明确归为 question,iot_query 需设备名词
- 图片附件支持 file_id 轻量引用(Gateway FileStore 解析 + 上传端点复用)
- API 文档更新:附件新格式 + 图片传递链路

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 19:27:25 +08:00
parent 3e15285065
commit c4de813629
9 changed files with 140 additions and 35 deletions
+9 -8
View File
@@ -2,14 +2,15 @@ package ws
// MessageAttachment 消息附件 (图片等)
type MessageAttachment struct {
Type string `json:"type"` // image
URL string `json:"url"` // 图片 URL 或 data URL
ThumbnailURL string `json:"thumbnail_url,omitempty"`
Filename string `json:"filename,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Size int64 `json:"size,omitempty"` // 文件大小 bytes
Description string `json:"description,omitempty"` // AI 对图片的描述
Type string `json:"type"` // image
URL string `json:"url,omitempty"` // 图片 URL 或 data URL(旧格式,向后兼容)
FileID string `json:"file_id,omitempty"` // 文件 ID(新格式,轻量引用)
ThumbnailURL string `json:"thumbnail_url,omitempty"` // 缩略图 URL
Filename string `json:"filename,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Size int64 `json:"size,omitempty"` // 文件大小 bytes
Description string `json:"description,omitempty"` // AI 对图片的描述
}
// 客户端 → 服务端消息