|
@@ -85,7 +85,7 @@ func (k *KnowledgeService) KnowledgeAdd(param *knowledgeclient.AddRequest, segme
|
|
}
|
|
}
|
|
questionVector, err := util.EncodeVector(param.Question)
|
|
questionVector, err := util.EncodeVector(param.Question)
|
|
if err != nil {
|
|
if err != nil {
|
|
- logx.Error("获取 向量失败 ",err)
|
|
|
|
|
|
+ logx.Error("获取 向量失败 ", err)
|
|
return false, "获取 向量失败 :" + err.Error()
|
|
return false, "获取 向量失败 :" + err.Error()
|
|
}
|
|
}
|
|
// 存入向量库
|
|
// 存入向量库
|
|
@@ -322,7 +322,6 @@ func (k *KnowledgeService) RecommendAnswer(param *knowledgeclient.FindAnswerReq,
|
|
//searchField = `"answer","question"`
|
|
//searchField = `"answer","question"`
|
|
answers []*knowledgeclient.Question
|
|
answers []*knowledgeclient.Question
|
|
)
|
|
)
|
|
- robotEntId := SE.Decode4Hex(param.RobotEntId)
|
|
|
|
////根据问题进行分词
|
|
////根据问题进行分词
|
|
//keywordsArr := util.HanlpGetNormalWords(param.Question, segment)
|
|
//keywordsArr := util.HanlpGetNormalWords(param.Question, segment)
|
|
//logx.Info("keywordsArr", keywordsArr)
|
|
//logx.Info("keywordsArr", keywordsArr)
|
|
@@ -341,7 +340,7 @@ func (k *KnowledgeService) RecommendAnswer(param *knowledgeclient.FindAnswerReq,
|
|
limit = recommendQuestionCount
|
|
limit = recommendQuestionCount
|
|
}
|
|
}
|
|
//res := elastic.GetAllByNgram(Index, Type, query, "", "", searchField, 0, limit, 0, false)
|
|
//res := elastic.GetAllByNgram(Index, Type, query, "", "", searchField, 0, limit, 0, false)
|
|
- query := util.GetAnswerQueryStr(param.Question, robotEntId, limit, ki.C.MinScore)
|
|
|
|
|
|
+ query := util.GetAnswerQueryStr(param.Question, param.RobotEntId, limit, ki.C.MinScore)
|
|
logx.Info("query:", query)
|
|
logx.Info("query:", query)
|
|
res := ESV7.Get(ESV7Index, ESV7Type, query)
|
|
res := ESV7.Get(ESV7Index, ESV7Type, query)
|
|
if res != nil && len(*res) > 0 {
|
|
if res != nil && len(*res) > 0 {
|