package response import ( "time" ) // ChatResponse 对话响应 type ChatResponse struct { ID uint `json:"id"` Title string `json:"title"` CharacterID *uint `json:"characterId"` CharacterName string `json:"characterName"` CharacterAvatar string `json:"characterAvatar"` ChatType string `json:"chatType"` LastMessageAt *time.Time `json:"lastMessageAt"` MessageCount int `json:"messageCount"` IsPinned bool `json:"isPinned"` LastMessage *MessageBrief `json:"lastMessage,omitempty"` // 最后一条消息摘要 CreatedAt time.Time `json:"createdAt"` } // MessageBrief 消息摘要(用于对话列表显示) type MessageBrief struct { Content string `json:"content"` Role string `json:"role"` } // ChatListResponse 对话列表响应 type ChatListResponse struct { List []ChatResponse `json:"list"` Total int64 `json:"total"` Page int `json:"page"` PageSize int `json:"pageSize"` } // MessageResponse 消息响应 type MessageResponse struct { ID uint `json:"id"` ChatID uint `json:"chatId"` Content string `json:"content"` Role string `json:"role"` // user / assistant / system CharacterID *uint `json:"characterId"` CharacterName string `json:"characterName,omitempty"` Model string `json:"model,omitempty"` PromptTokens int `json:"promptTokens,omitempty"` CompletionTokens int `json:"completionTokens,omitempty"` TotalTokens int `json:"totalTokens,omitempty"` SequenceNumber int `json:"sequenceNumber"` CreatedAt time.Time `json:"createdAt"` } // MessageListResponse 消息列表响应 type MessageListResponse struct { List []MessageResponse `json:"list"` Total int64 `json:"total"` Page int `json:"page"` PageSize int `json:"pageSize"` } // ChatDetailResponse 对话详情响应(包含角色信息 + 消息列表) type ChatDetailResponse struct { Chat ChatResponse `json:"chat"` Messages []MessageResponse `json:"messages"` }