瀏覽代碼

修改文案

kobe6258 5 天之前
父節點
當前提交
d235671e07
共有 2 個文件被更改,包括 17 次插入1 次删除
  1. 12 1
      controllers/llm/promote_controller.go
  2. 5 0
      services/llm/facade/llm_service.go

+ 12 - 1
controllers/llm/promote_controller.go

@@ -56,12 +56,23 @@ func (pCtrl *PromoteController) GenerateContent() {
 		Role:     "user",
 		SendTime: userSendTime.Format(utils.FormatDateTime),
 	}
+	article, err := rag.GetArticleById(gcReq.WechatArticleId)
+	if err != nil {
+		br.Msg = "获取公众号内容失败"
+		br.ErrMsg = "获取公众号内容失败,Err:" + err.Error()
+		return
+	}
+	if article.TextContent == "" {
+		br.Msg = "暂不支持纯文本以外的内容生成"
+		br.ErrMsg = "暂不支持纯文本以外的内容生成"
+		return
+	}
 	res, err := facade.AIGCBaseOnPromote(facade.AIGC{
 		Promote:   gcReq.Promote,
 		ArticleId: gcReq.WechatArticleId,
 	})
 	if err != nil {
-		br.Msg = "内容生成失败"
+		br.Msg = err.Error()
 		br.ErrMsg = "内容生成失败,Err:" + err.Error()
 		return
 	}

+ 5 - 0
services/llm/facade/llm_service.go

@@ -65,6 +65,11 @@ func AIGCBaseOnPromote(aigc AIGC) (resp bus_response.AIGCEtaResponse, err error)
 				err = fmt.Errorf("公众号文章不存在")
 				return
 			}
+			if article.TextContent == "" {
+				utils.FileLog.Error("暂不支持纯文本以外的内容生成")
+				err = fmt.Errorf("暂不支持纯文本以外的内容生成")
+				return
+			}
 			// 文章加入到知识库
 			path, fileErr := localService.CreateArticleFile(article)
 			if fileErr != nil {