27 lines
1.3 KiB
Go
27 lines
1.3 KiB
Go
package app
|
|
|
|
import (
|
|
"git.echol.cn/loser/ai_proxy/server/global"
|
|
)
|
|
|
|
// AiRequestLog AI请求日志
|
|
type AiRequestLog struct {
|
|
global.GVA_MODEL
|
|
UserID *uint `json:"userId" gorm:"comment:用户ID;index"`
|
|
PresetID *uint `json:"presetId" gorm:"comment:预设ID"`
|
|
ProviderID *uint `json:"providerId" gorm:"comment:提供商ID"`
|
|
OriginalMessage string `json:"originalMessage" gorm:"comment:原始消息;type:text"`
|
|
InjectedPrompt map[string]interface{} `json:"injectedPrompt" gorm:"comment:注入后的提示词;type:jsonb;serializer:json"`
|
|
ResponseText string `json:"responseText" gorm:"comment:响应文本;type:text"`
|
|
ResponseTokens int `json:"responseTokens" gorm:"comment:响应Token数"`
|
|
PromptTokens int `json:"promptTokens" gorm:"comment:提示Token数"`
|
|
TotalTokens int `json:"totalTokens" gorm:"comment:总Token数"`
|
|
LatencyMs int `json:"latencyMs" gorm:"comment:延迟(毫秒)"`
|
|
Status string `json:"status" gorm:"comment:状态;size:20"` // success/error/timeout
|
|
ErrorMessage string `json:"errorMessage" gorm:"comment:错误信息;type:text"`
|
|
}
|
|
|
|
func (AiRequestLog) TableName() string {
|
|
return "ai_request_logs"
|
|
}
|