package models // AIConversation AI对话主表 type AIConversation struct { BaseModel UserId uint64 `gorm:"type:bigint;not null;comment:用户ID" json:"user_id"` Content string `gorm:"type:text;not null;comment:对话内容" json:"content"` BusinessType int `gorm:"type:tinyint;not null;comment:业务类型(0、AI问答,1、安全培训,2、AI写作,3、考试工坊)" json:"business_type"` ExamName string `gorm:"type:varchar(255);not null;comment:考试名称" json:"exam_name"` //步骤 Step int `gorm:"type:int;not null;comment:步骤" json:"step"` //封面图 CoverImage string `gorm:"type:varchar(1000);not null;comment:封面图" json:"cover_image"` //PPTjson地址 PPTJsonUrl string `gorm:"type:varchar(1000);not null;comment:PPTjson地址" json:"ppt_json_url"` //PPTJson内容 PPTJsonContent string `gorm:"type:longtext;not null;comment:PPTjson内容" json:"ppt_json_content"` //PPT大纲 PPTOutline string `gorm:"type:longtext;not null;comment:PPT大纲" json:"ppt_outline"` } // TableName 指定表名 func (AIConversation) TableName() string { return "ai_conversation" } // AIMessage AI对话消息表 type AIMessage struct { BaseModel UserId uint64 `gorm:"type:bigint;not null;comment:用户ID" json:"user_id"` Content string `gorm:"type:longtext;not null;comment:对话内容" json:"content"` Type string `gorm:"type:varchar(20);not null;comment:对话类型(user、ai)" json:"type"` UserFeedback int `gorm:"type:tinyint;not null;comment:用户反馈(0、无反馈,2、满意(赞),3、不满意(踩))" json:"user_feedback"` //绑定上一句的用户问题ID PrevUserId uint64 `gorm:"type:bigint;not null;comment:上一句的用户问题ID" json:"prev_user_id"` AIConversationId uint64 `gorm:"type:bigint;not null;comment:AI对话ID" json:"ai_conversation_id"` //搜索来源 SearchSource string `gorm:"type:longtext;not null;comment:搜索来源" json:"search_source"` //猜你想问 GuessYouWant string `gorm:"type:varchar(255);not null;comment:猜你想问" json:"guess_you_want"` } // TableName 指定表名 func (AIMessage) TableName() string { return "ai_message" } // 索引文件表 type IndexFile struct { BaseModel FileName string `gorm:"type:varchar(255);not null;comment:文件名" json:"file_name"` FilePath string `gorm:"type:varchar(1000);not null;comment:文件路径" json:"file_path"` //编码 Encoding string `gorm:"type:varchar(255);not null;comment:编码" json:"encoding"` } // TableName 指定表名 func (IndexFile) TableName() string { return "index_file" } // 问答QA对表 type QA struct { BaseModel Question string `gorm:"type:varchar(255);not null;comment:问题" json:"question"` Answer string `gorm:"type:varchar(255);not null;comment:答案" json:"answer"` } // TableName 指定表名 func (QA) TableName() string { return "qa" }