Roc 1 month ago
parent
commit
60ecf78753
4 changed files with 22 additions and 2 deletions
  1. 12 0
      controllers/llm/report.go
  2. 7 0
      models/report.go
  3. 3 1
      services/llm_report.go
  4. 0 1
      services/task.go

+ 12 - 0
controllers/llm/report.go

@@ -229,3 +229,15 @@ func (c *RagEtaReportController) ArticleDel() {
 	br.Success = true
 	br.Msg = "删除成功"
 }
+
+//// 修复历史ETA报告到知识库
+//func init() {
+//	idList, err := models.GetAllPublishReportId()
+//	if err != nil {
+//		fmt.Println("查询失败:", err.Error())
+//		return
+//	}
+//	for _, v := range idList {
+//		cache.RagEtaReportOpToCache(v, 0, "publish")
+//	}
+//}

+ 7 - 0
models/report.go

@@ -1690,3 +1690,10 @@ type ReportShartUrlReq struct {
 type ReportShartUrlResp struct {
 	UrlToken string `description:"分享链接token"`
 }
+
+func GetAllPublishReportId() (items []int, err error) {
+	o := global.DbMap[utils.DbNameReport]
+	sql := `SELECT  a.id FROM report as a WHERE 1=1 AND state in (2,6) limit 20`
+	err = o.Raw(sql).Find(&items).Error
+	return
+}

+ 3 - 1
services/llm_report.go

@@ -83,7 +83,9 @@ func ReportAddOrModifyKnowledgeByReportId(reportId int) {
 	// 如果是单篇报告,那么直接处理
 	if reportInfo.HasChapter == 0 {
 		err = handleReportAddOrModifyKnowledge(reportId, 0, reportInfo.Title, reportInfo.Author, reportInfo.Content, reportInfo.PublishTime)
-		errList = append(errList, err.Error())
+		if err != nil {
+			errList = append(errList, err.Error())
+		}
 		return
 	}
 

+ 0 - 1
services/task.go

@@ -669,7 +669,6 @@ func HandleEtaReportKnowledgeLLmOp() {
 				ReportAddOrModifyKnowledgeByReportId(ragEtaReportOpOp.ReportId)
 			case `un_publish`:
 				ReportUnPublishedKnowledgeByReportId(ragEtaReportOpOp.ReportId)
-
 			}
 
 		})