package app import ( "git.echol.cn/loser/ai_proxy/server/global" "time" ) // AiRequestLog AI请求日志 type AiRequestLog struct { global.GVA_MODEL UserID uint `json:"user_id" gorm:"index;comment:用户ID"` BindingID uint `json:"binding_id" gorm:"index;comment:绑定ID"` ProviderID uint `json:"provider_id" gorm:"index;comment:提供商ID"` PresetID uint `json:"preset_id" gorm:"index;comment:预设ID"` Model string `json:"model" gorm:"type:varchar(100);comment:使用的模型"` PromptTokens int `json:"prompt_tokens" gorm:"comment:输入token数"` CompletionTokens int `json:"completion_tokens" gorm:"comment:输出token数"` TotalTokens int `json:"total_tokens" gorm:"comment:总token数"` Duration int64 `json:"duration" gorm:"comment:请求耗时(毫秒)"` Status string `json:"status" gorm:"type:varchar(20);index;comment:请求状态"` // success, error ErrorMessage string `json:"error_message" gorm:"type:text;comment:错误信息"` RequestTime time.Time `json:"request_time" gorm:"index;comment:请求时间"` } func (AiRequestLog) TableName() string { return "ai_request_logs" }