123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package rag
- import (
- "eta/eta_api/global"
- "eta/eta_api/utils"
- "time"
- )
- // ArticleAbstractHistory 文章/报告摘要历史记录表
- type ArticleAbstractHistory struct {
- ArticleAbstractHistoryID int `gorm:"primaryKey;column:article_abstract_history_id" description:"-"`
- Source int8 `gorm:"column:source" description:"来源,0:公众号文章,1:eta报告"`
- ArticleAbstractID int `gorm:"column:article_abstract_id" description:"文章/报告摘要id"`
- ArticleID int `gorm:"column:article_id" description:"文章/报告Id"`
- QuestionId int `gorm:"column:question_id" description:"提示词Id"`
- Tags string `gorm:"column:tags" description:"标签"`
- TagsName string `gorm:"column:tags_name" description:"标签名,多个用英文逗号隔开"`
- QuestionContent string `gorm:"column:question_content" description:"questionContent"`
- Content string `gorm:"column:content" description:"摘要内容"`
- Version int `gorm:"column:version" description:"版本号"`
- VectorKey string `gorm:"column:vector_key" description:"向量key标识"`
- ModifyTime time.Time `gorm:"column:modify_time" description:"modifyTime"`
- CreateTime time.Time `gorm:"column:create_time" description:"createTime"`
- }
- // TableName get sql table name.获取数据库表名
- func (m *ArticleAbstractHistory) TableName() string {
- return "article_abstract_history"
- }
- // ArticleAbstractHistoryColumns get sql column name.获取数据库列名
- var ArticleAbstractHistoryColumns = struct {
- ArticleAbstractHistoryID string
- Source string
- ArticleAbstractID string
- ArticleID string
- QuestionId string
- Tags string
- TagsName string
- QuestionContent string
- Content string
- Version string
- VectorKey string
- ModifyTime string
- CreateTime string
- }{
- ArticleAbstractHistoryID: "article_abstract_history_id",
- Source: "source",
- ArticleAbstractID: "article_abstract_id",
- ArticleID: "article_id",
- QuestionId: "question_id",
- Tags: "tags",
- TagsName: "tags_name",
- QuestionContent: "question_content",
- Content: "content",
- Version: "version",
- VectorKey: "vector_key",
- ModifyTime: "modify_time",
- CreateTime: "create_time",
- }
- func (m *ArticleAbstractHistory) Create() (err error) {
- err = global.DbMap[utils.DbNameAI].Create(&m).Error
- return
- }
- // AddArticleAbstractHistoryByWechatArticleAbstract
- // @Description: 根据eta报告摘要添加历史记录
- // @author: Roc
- // @datetime 2025-04-17 14:05:10
- // @param item *WechatArticleAbstract
- func AddArticleAbstractHistoryByWechatArticleAbstract(item *WechatArticleAbstract) {
- history := &ArticleAbstractHistory{
- ArticleAbstractHistoryID: 0,
- Source: 0,
- ArticleAbstractID: item.WechatArticleAbstractId,
- ArticleID: item.WechatArticleId,
- QuestionId: item.QuestionId,
- Tags: item.Tags,
- TagsName: item.TagsName,
- QuestionContent: item.QuestionContent,
- Content: item.Content,
- Version: item.Version,
- VectorKey: item.VectorKey,
- ModifyTime: time.Now(),
- CreateTime: time.Now(),
- }
- _ = history.Create()
- }
- // AddArticleAbstractHistoryByWechatArticleAbstract
- // @Description: 根据eta报告摘要添加历史记录
- // @author: Roc
- // @datetime 2025-04-17 14:05:10
- // @param item *WechatArticleAbstract
- func AddArticleAbstractHistoryByRagEtaReportAbstract(item *RagEtaReportAbstract) {
- history := &ArticleAbstractHistory{
- ArticleAbstractHistoryID: 0,
- Source: 0,
- ArticleAbstractID: item.RagEtaReportAbstractId,
- ArticleID: item.RagEtaReportId,
- QuestionId: item.QuestionId,
- Tags: item.Tags,
- TagsName: item.TagsName,
- QuestionContent: item.QuestionContent,
- Content: item.Content,
- Version: item.Version,
- VectorKey: item.VectorKey,
- ModifyTime: time.Now(),
- CreateTime: time.Now(),
- }
- _ = history.Create()
- }
|