26 lines
1.1 KiB
Go
26 lines
1.1 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// BackendAiChatMessage AI聊天消息表
|
|
type BackendAiChatMessage struct {
|
|
ID uint64 `orm:"column(id);pk;auto" json:"id"`
|
|
TenantID string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
|
|
SessionID uint64 `orm:"column(session_id)" json:"session_id"`
|
|
Role string `orm:"column(role);size(20)" json:"role"` // user / assistant
|
|
Content string `orm:"column(content);type(text)" json:"content"`
|
|
// Images 用户上传的图片(base64 dataURL 的 JSON 数组),仅 user 消息使用
|
|
Images string `orm:"column(images);type(text)" json:"images"`
|
|
// Tokens 本次响应消耗的 token 总数(0 表示未统计到)
|
|
Tokens int `orm:"column(tokens)" json:"tokens"`
|
|
// DurationMs AI 响应耗时(毫秒,含工具调用轮次)
|
|
DurationMs int `orm:"column(duration_ms)" json:"duration_ms"`
|
|
// Model 生成该消息使用的模型
|
|
Model string `orm:"column(model);size(64)" json:"model"`
|
|
CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"`
|
|
}
|
|
|
|
func (m *BackendAiChatMessage) TableName() string {
|
|
return "yz_backend_ai_chat_message"
|
|
}
|