This commit is contained in:
2025-09-10 20:40:06 +08:00
parent 73063af861
commit 8991a00e17
7 changed files with 101 additions and 96 deletions
+20 -22
View File
@@ -2,8 +2,6 @@ package response
import (
"time"
"github.com/flipped-aurora/gin-vue-admin/server/model/pet"
)
// ChatResponse 宠物助手聊天响应结构体
@@ -26,37 +24,37 @@ type StreamEvent struct {
Data interface{} `json:"data"` // 事件数据
}
// StreamMessageData 流式消息数据结构体
// StreamMessageData 流式消息数据结构体(简化版)
type StreamMessageData struct {
Delta string `json:"delta"` // 增量消息内容
SessionId string `json:"sessionId"` // 会话ID
RequestId string `json:"requestId"` // 请求ID
Delta string `json:"delta"` // 增量消息内容
}
// StreamErrorData 流式错误数据结构体
// StreamErrorData 流式错误数据结构体(简化版)
type StreamErrorData struct {
Error string `json:"error"` // 错误信息
Code string `json:"code"` // 错误代码
RequestId string `json:"requestId"` // 请求ID
Error string `json:"error"` // 错误信息
}
// StreamDoneData 流式完成数据结构体
// StreamDoneData 流式完成数据结构体(简化版)
type StreamDoneData struct {
Message string `json:"message"` // 完整消息内容
SessionId string `json:"sessionId"` // 会话ID
RequestId string `json:"requestId"` // 请求ID
TokenCount int `json:"tokenCount"` // Token消耗数量
ResponseTime int64 `json:"responseTime"` // 响应时间(毫秒)
IsSensitive bool `json:"isSensitive"` // 是否包含敏感词
FinishReason string `json:"finishReason"` // 完成原因
Message string `json:"message"` // 完整消息内容
SessionId string `json:"sessionId"` // 会话ID
}
// ChatHistoryItem 聊天历史项结构体(简化版)
type ChatHistoryItem struct {
ID uint `json:"id"` // 消息ID
Role string `json:"role"` // 角色:user/assistant
Message string `json:"message"` // 消息内容
SessionId string `json:"sessionId"` // 会话ID
CreatedAt time.Time `json:"createdAt"` // 创建时间
}
// ChatHistoryResponse 聊天历史响应结构体
type ChatHistoryResponse struct {
List []pet.PetAiAssistantConversations `json:"list"` // 对话记录列表
Total int64 `json:"total"` // 总记录数
Page int `json:"page"` // 当前页码
PageSize int `json:"pageSize"` // 每页大小
List []ChatHistoryItem `json:"list"` // 对话记录列表
Total int64 `json:"total"` // 总记录数
Page int `json:"page"` // 当前页码
PageSize int `json:"pageSize"` // 每页大小
}
// SessionInfo 会话信息结构体