chat.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Package models - chat.go
  2. //
  3. // ⚠️ DEPRECATED NOTICE (弃用说明)
  4. // ================================================================================
  5. // 本文件中的数据模型定义仍在使用中,但AI对话核心逻辑已迁移至微服务。
  6. // ================================================================================
  7. package models
  8. // AIConversation AI对话主表
  9. type AIConversation struct {
  10. BaseModel
  11. UserId uint64 `gorm:"type:bigint;not null;comment:用户ID" json:"user_id"`
  12. Content string `gorm:"type:text;not null;comment:对话内容" json:"content"`
  13. BusinessType int `gorm:"type:tinyint;not null;comment:业务类型(0、AI问答,1、安全培训,2、AI写作,3、考试工坊)" json:"business_type"`
  14. ExamName string `gorm:"type:varchar(255);not null;comment:考试名称" json:"exam_name"`
  15. //步骤
  16. Step int `gorm:"type:int;not null;comment:步骤" json:"step"`
  17. //封面图
  18. CoverImage string `gorm:"type:varchar(1000);not null;comment:封面图" json:"cover_image"`
  19. //PPTjson地址
  20. PPTJsonUrl string `gorm:"type:varchar(1000);not null;comment:PPTjson地址" json:"ppt_json_url"`
  21. //PPTJson内容
  22. PPTJsonContent string `gorm:"type:longtext;not null;comment:PPTjson内容" json:"ppt_json_content"`
  23. //PPT大纲
  24. PPTOutline string `gorm:"type:longtext;not null;comment:PPT大纲" json:"ppt_outline"`
  25. }
  26. // TableName 指定表名
  27. func (AIConversation) TableName() string {
  28. return "ai_conversation"
  29. }
  30. // AIMessage AI对话消息表
  31. type AIMessage struct {
  32. BaseModel
  33. UserId uint64 `gorm:"type:bigint;not null;comment:用户ID" json:"user_id"`
  34. Content string `gorm:"type:longtext;not null;comment:对话内容" json:"content"`
  35. Type string `gorm:"type:varchar(20);not null;comment:对话类型(user、ai)" json:"type"`
  36. UserFeedback int `gorm:"type:tinyint;not null;comment:用户反馈(0、无反馈,2、满意(赞),3、不满意(踩))" json:"user_feedback"`
  37. //绑定上一句的用户问题ID
  38. PrevUserId uint64 `gorm:"type:bigint;not null;comment:上一句的用户问题ID" json:"prev_user_id"`
  39. AIConversationId uint64 `gorm:"type:bigint;not null;comment:AI对话ID" json:"ai_conversation_id"`
  40. //搜索来源
  41. SearchSource string `gorm:"type:longtext;not null;comment:搜索来源" json:"search_source"`
  42. //猜你想问
  43. GuessYouWant string `gorm:"type:varchar(255);not null;comment:猜你想问" json:"guess_you_want"`
  44. }
  45. // TableName 指定表名
  46. func (AIMessage) TableName() string {
  47. return "ai_message"
  48. }
  49. // 索引文件表
  50. type IndexFile struct {
  51. BaseModel
  52. FileName string `gorm:"type:varchar(255);not null;comment:文件名" json:"file_name"`
  53. FilePath string `gorm:"type:varchar(1000);not null;comment:文件路径" json:"file_path"`
  54. //编码
  55. Encoding string `gorm:"type:varchar(255);not null;comment:编码" json:"encoding"`
  56. }
  57. // TableName 指定表名
  58. func (IndexFile) TableName() string {
  59. return "index_file"
  60. }
  61. // 问答QA对表
  62. type QA struct {
  63. BaseModel
  64. Question string `gorm:"type:varchar(255);not null;comment:问题" json:"question"`
  65. Answer string `gorm:"type:varchar(255);not null;comment:答案" json:"answer"`
  66. }
  67. // TableName 指定表名
  68. func (QA) TableName() string {
  69. return "qa"
  70. }