kobe6258 6 days ago
parent
commit
b76bce52ca

+ 1 - 0
controllers/llm/llm_http/request.go

@@ -29,6 +29,7 @@ type GenerateContentReq struct {
 type SaveContentReq struct {
 	WechatArticleId int             `json:"WechatArticleId" description:"公众号Id"`
 	Title           string          `json:"Title" description:"标题"`
+	Llm             string          `json:"LLM"`
 	Promote         json.RawMessage `json:"Promote" description:"提示词"`
 	AigcContent     json.RawMessage `json:"AigcContent" description:"生成内容"`
 }

+ 5 - 0
controllers/llm/promote_controller.go

@@ -9,6 +9,7 @@ import (
 	"eta/eta_api/services/llm/facade"
 	"eta/eta_api/utils"
 	"fmt"
+	"strings"
 	"time"
 )
 
@@ -87,9 +88,11 @@ func (pCtrl *PromoteController) GenerateContent() {
 		Promote: userContent,
 		Answer:  aiContent,
 	}
+	llm := strings.ReplaceAll(gcReq.LLMModel, ":", "")
 	saveContentReq := rag.PromoteTrainRecord{
 		WechatArticleId: gcReq.WechatArticleId,
 		Title:           userContent.Content,
+		Llm:             llm,
 		AigcContent:     res.Answer,
 		AigcSendTime:    aiSendTime,
 		TemplatePromote: userContent.Content,
@@ -190,9 +193,11 @@ func (pCtrl *PromoteController) SavePromoteContent() {
 		br.ErrMsg = "AI生成时间不能为空"
 		return
 	}
+	llm := strings.ReplaceAll(gcReq.Llm, ":", "")
 	saveContentReq := rag.PromoteTrainRecord{
 		WechatArticleId: gcReq.WechatArticleId,
 		Title:           titile,
+		Llm:             llm,
 		AigcContent:     assistantContent.Content,
 		AigcSendTime:    assistantSendTime,
 		TemplatePromote: userContent.Content,

+ 3 - 0
models/rag/promote_train_record.go

@@ -9,6 +9,7 @@ import (
 type PromoteTrainRecord struct {
 	Id              int       `gorm:"id;primaryKey"`
 	Title           string    `gorm:"title"`
+	Llm             string    `gorm:"llm"`
 	WechatArticleId int       `gorm:"wechat_article_id"`
 	TemplatePromote string    `gorm:"template_promote"`
 	PromoteSendTime time.Time `gorm:"promote_send_time"`
@@ -23,6 +24,7 @@ func (p *PromoteTrainRecord) ToView() *PromoteTrainRecordView {
 	return &PromoteTrainRecordView{
 		Id:              p.Id,
 		Title:           p.Title,
+		Llm:             p.Llm,
 		WechatArticleId: p.WechatArticleId,
 		TemplatePromote: p.TemplatePromote,
 		PromoteSendTime: p.PromoteSendTime.Format(utils.FormatDateTime),
@@ -34,6 +36,7 @@ func (p *PromoteTrainRecord) ToView() *PromoteTrainRecordView {
 type PromoteTrainRecordView struct {
 	Id              int
 	Title           string
+	Llm             string
 	WechatArticleId int
 	TemplatePromote string
 	PromoteSendTime string