Roc 1 周之前
父節點
當前提交
87ab37e363
共有 1 個文件被更改,包括 28 次插入10 次删除
  1. 28 10
      controllers/llm/promote_controller.go

+ 28 - 10
controllers/llm/promote_controller.go

@@ -62,16 +62,34 @@ 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
+
+	switch gcReq.Source {
+	case 0:
+		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
+		}
+	case 1:
+		obj := rag.RagEtaReport{}
+		article, err := obj.GetById(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,