feat: 增加sse支持

This commit is contained in:
2025-12-29 10:27:17 +08:00
parent 8511f311f8
commit f424813a08
3 changed files with 84 additions and 4 deletions

View File

@@ -139,3 +139,13 @@ type ResponseOption struct {
Extension map[string]any `json:"extension"` // 扩展数据
XmlName string `json:"xml_name"` // 以xml文件格式响应数据时, Xml文件名(根节点)
}
type SseData struct {
ID string `json:"id"` // 响应数据 ID
Object string `json:"object"` // 响应数据对象类型
Created int64 `json:"created"` // 创建时间, 秒级时间戳
Choices []map[string]any `json:"choices"` // choice 列表
EventType string `json:"event_type"` // 事件类型
}
const SseMsgFormat = "id:%v\nevent:%v\ndata:%v\n\n"