Răsfoiți Sursa

Merge branch 'rag/4.0' into debug

Roc 2 zile în urmă
părinte
comite
6aba404b44

+ 1 - 1
models/rag/request/rag_eta_report.go

@@ -4,6 +4,6 @@ type BeachOpRagEtaReportAbstractReq struct {
 	RagEtaReportAbstractIdList    []int  `description:"摘要id"`
 	NotRagEtaReportAbstractIdList []int  `description:"不需要的摘要id"`
 	KeyWord                       string `description:"关键字"`
-	TagId                         int    `description:"标签id"`
+	TagId                         string `description:"标签id"`
 	IsSelectAll                   bool   `description:"是否选择所有摘要"`
 }

+ 1 - 1
models/rag/request/wechat_platform.go

@@ -28,6 +28,6 @@ type BeachOpAbstractReq struct {
 	WechatArticleAbstractIdList    []int  `description:"摘要id"`
 	NotWechatArticleAbstractIdList []int  `description:"不需要的摘要id"`
 	KeyWord                        string `description:"关键字"`
-	TagId                          int    `description:"标签id"`
+	TagId                          string `description:"标签id"`
 	IsSelectAll                    bool   `description:"是否选择所有摘要"`
 }

+ 7 - 0
services/elastic/rag_eta_report_abstract.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_api/utils"
 	"fmt"
 	"github.com/olivere/elastic/v7"
+	"strings"
 	"time"
 )
 
@@ -24,6 +25,7 @@ type RagEtaReportAbstractItem struct {
 	CreateTime             time.Time `gorm:"column:create_time" description:"createTime"`
 	Title                  string    `gorm:"column:title;type:varchar(255);comment:标题;" description:"标题"`
 	TagIdList              []int     `description:"品种id列表"`
+	TagNameList            []string  `description:"品种名称列表"`
 }
 
 func (m *RagEtaReportAbstractItem) ToView() rag.RagEtaReportAbstractView {
@@ -40,6 +42,10 @@ func (m *RagEtaReportAbstractItem) ToView() rag.RagEtaReportAbstractView {
 	//if len(m.TagIdList) > 0 {
 	//	tagId = m.TagIdList[0]
 	//}
+	tagsName := ``
+	if len(m.TagNameList) > 0 {
+		tagsName = strings.Join(m.TagNameList, `,`)
+	}
 
 	return rag.RagEtaReportAbstractView{
 		RagEtaReportAbstractId: m.RagEtaReportAbstractId,
@@ -53,6 +59,7 @@ func (m *RagEtaReportAbstractItem) ToView() rag.RagEtaReportAbstractView {
 		ModifyTime: modifyTime,
 		CreateTime: createTime,
 		Title:      m.Title,
+		TagsName:   tagsName,
 	}
 }
 

+ 7 - 0
services/elastic/wechat_article_abstract.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_api/utils"
 	"fmt"
 	"github.com/olivere/elastic/v7"
+	"strings"
 	"time"
 )
 
@@ -26,6 +27,7 @@ type WechatArticleAbstractItem struct {
 	Title                   string    `gorm:"column:title;type:varchar(255);comment:标题;" description:"标题"`
 	Link                    string    `gorm:"column:link;type:varchar(255);comment:链接;" description:"链接"`
 	TagIdList               []int     `description:"品种id列表"`
+	TagNameList             []string  `description:"品种名称列表"`
 }
 
 func (m *WechatArticleAbstractItem) ToView() rag.WechatArticleAbstractView {
@@ -42,6 +44,10 @@ func (m *WechatArticleAbstractItem) ToView() rag.WechatArticleAbstractView {
 	if len(m.TagIdList) > 0 {
 		tagId = m.TagIdList[0]
 	}
+	tagsName := ``
+	if len(m.TagNameList) > 0 {
+		tagsName = strings.Join(m.TagNameList, `,`)
+	}
 	return rag.WechatArticleAbstractView{
 		WechatArticleAbstractId: m.WechatArticleAbstractId,
 		WechatArticleId:         m.WechatArticleId,
@@ -55,6 +61,7 @@ func (m *WechatArticleAbstractItem) ToView() rag.WechatArticleAbstractView {
 		Title:                   m.Title,
 		Link:                    m.Link,
 		TagId:                   tagId,
+		TagsName:                tagsName,
 	}
 }
 

+ 6 - 0
services/llm_report.go

@@ -505,6 +505,11 @@ func AddOrEditEsRagEtaReportAbstract(ragEtaReportAbstractId int) {
 		}
 	}
 
+	tagNameList := make([]string, 0)
+	if abstractInfo.TagsName != `` {
+		tagNameList = strings.Split(abstractInfo.TagsName, ",")
+	}
+
 	esItem := elastic.RagEtaReportAbstractItem{
 		RagEtaReportAbstractId: abstractInfo.RagEtaReportAbstractId,
 		RagEtaReportId:         abstractInfo.RagEtaReportId,
@@ -516,6 +521,7 @@ func AddOrEditEsRagEtaReportAbstract(ragEtaReportAbstractId int) {
 		CreateTime:             abstractInfo.CreateTime,
 		Title:                  articleInfo.Title,
 		TagIdList:              tagIdList,
+		TagNameList:            tagNameList,
 	}
 
 	err = elastic.RagEtaReportAbstractEsAddOrEdit(strconv.Itoa(abstractInfo.RagEtaReportAbstractId), esItem)

+ 6 - 0
services/wechat_platform.go

@@ -1097,6 +1097,11 @@ func AddOrEditEsWechatArticleAbstract(articleAbstractId int) {
 		}
 	}
 
+	tagNameList := make([]string, 0)
+	if abstractInfo.TagsName != `` {
+		tagNameList = strings.Split(abstractInfo.TagsName, ",")
+	}
+
 	esItem := elastic.WechatArticleAbstractItem{
 		WechatArticleAbstractId: abstractInfo.WechatArticleAbstractId,
 		WechatArticleId:         abstractInfo.WechatArticleId,
@@ -1110,6 +1115,7 @@ func AddOrEditEsWechatArticleAbstract(articleAbstractId int) {
 		Title:                   articleInfo.Title,
 		Link:                    articleInfo.Link,
 		TagIdList:               tagIdList,
+		TagNameList:             tagNameList,
 	}
 
 	err = elastic.WechatArticleAbstractEsAddOrEdit(strconv.Itoa(articleAbstractId), esItem)