|
@@ -252,9 +252,11 @@ func GenerateArticleAbstract(item *rag.WechatArticle) {
|
|
|
}
|
|
|
|
|
|
abstractObj := rag.WechatArticleAbstract{}
|
|
|
- _, err = abstractObj.GetByWechatArticleId(item.WechatArticleId)
|
|
|
+ tmpAbstractItem, err := abstractObj.GetByWechatArticleId(item.WechatArticleId)
|
|
|
if err == nil {
|
|
|
// 摘要已经生成,不需要重复生成
|
|
|
+ AbstractToKnowledge(item, tmpAbstractItem, false)
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
if !utils.IsErrNoRow(err) {
|
|
@@ -470,6 +472,11 @@ func DelDoc(wechatArticleAbstractList []*rag.WechatArticleAbstract) (err error)
|
|
|
wechatArticleAbstractIdList = append(wechatArticleAbstractIdList, v.WechatArticleAbstractId)
|
|
|
}
|
|
|
|
|
|
+ // 没有就不删除
|
|
|
+ if len(vectorKeyList) <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
_, err = llm.DelDocsToKnowledge(models.BusinessConfMap[models.KnowledgeBaseName], vectorKeyList)
|
|
|
if err != nil {
|
|
|
err = fmt.Errorf("删除LLM摘要向量库文件失败,Err:" + err.Error())
|
|
@@ -493,6 +500,11 @@ func getAnswerByContent(wechatArticleId int, docId string) (answer string, addAr
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 没问题就不生成了
|
|
|
+ if len(questionList) <= 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
//你现在是一名资深的期货行业分析师,请基于以下的问题进行汇总总结,如果不能正常总结出来,那么就只需要回复我:sorry
|
|
|
questionStrList := []string{`你现在是一名资深的期货行业分析师,请基于以下的问题进行汇总总结,如果不能正常总结出来,那么就只需要回复我:sorry。以下是问题:`}
|
|
|
for _, v := range questionList {
|
|
@@ -945,6 +957,7 @@ func AddOrEditEsWechatArticleAbstract(articleAbstractId int) {
|
|
|
esItem := elastic.WechatArticleAbstractItem{
|
|
|
WechatArticleAbstractId: abstractInfo.WechatArticleAbstractId,
|
|
|
WechatArticleId: abstractInfo.WechatArticleId,
|
|
|
+ WechatPlatformId: articleInfo.WechatPlatformId,
|
|
|
Abstract: abstractInfo.Content,
|
|
|
Version: abstractInfo.Version,
|
|
|
VectorKey: abstractInfo.VectorKey,
|