|
@@ -260,6 +260,9 @@ func (k *KnowledgeService) KnowledgeDel(answerId int64) (ok bool) {
|
|
// FindAnswer 根据问题推荐一个答案
|
|
// FindAnswer 根据问题推荐一个答案
|
|
func (k *KnowledgeService) FindAnswer(param *knowledgeclient.FindAnswerReq, addr, index, segment string) *knowledgeclient.Question {
|
|
func (k *KnowledgeService) FindAnswer(param *knowledgeclient.FindAnswerReq, addr, index, segment string) *knowledgeclient.Question {
|
|
var question knowledgeclient.Question
|
|
var question knowledgeclient.Question
|
|
|
|
+ if len([]rune(param.Question)) <= 1 {
|
|
|
|
+ return &question
|
|
|
|
+ }
|
|
robotEntId := SE.Decode4Hex(param.RobotEntId)
|
|
robotEntId := SE.Decode4Hex(param.RobotEntId)
|
|
//组装es query
|
|
//组装es query
|
|
//query := util.DSL4SmartResponse(param.Question, robotEntId, int(param.Type), addr, index, segment)
|
|
//query := util.DSL4SmartResponse(param.Question, robotEntId, int(param.Type), addr, index, segment)
|
|
@@ -296,6 +299,9 @@ func (k *KnowledgeService) RecommendAnswer(param *knowledgeclient.FindAnswerReq,
|
|
var (
|
|
var (
|
|
answers []*knowledgeclient.Question
|
|
answers []*knowledgeclient.Question
|
|
)
|
|
)
|
|
|
|
+ if len([]rune(param.Question)) <= 1 {
|
|
|
|
+ return answers
|
|
|
|
+ }
|
|
limit := 3
|
|
limit := 3
|
|
if param.ReqSource == 1 {
|
|
if param.ReqSource == 1 {
|
|
limit = recommendQuestionCount
|
|
limit = recommendQuestionCount
|