Files
ai_proxy/server/model/app/response/ai_proxy.go
2026-03-03 06:05:51 +08:00

39 lines
940 B
Go

package response
// ChatCompletionResponse OpenAI兼容的聊天补全响应
type ChatCompletionResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []Choice `json:"choices"`
Usage Usage `json:"usage"`
}
// Choice 选择项
type Choice struct {
Index int `json:"index"`
Message Message `json:"message"`
FinishReason string `json:"finish_reason"`
}
// Message 消息
type Message struct {
Role string `json:"role"`
Content string `json:"content"`
}
// Usage Token使用情况
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
}
// StreamChunk 流式响应块
type StreamChunk struct {
Content string `json:"content"`
Done bool `json:"done"`
Error error `json:"error,omitempty"`
}