我在这里=> https://github.com/googleapis/nodejs-dialogflow/blob/master/samples/detect.v2beta1.js#L371-L414上看到了该方法,并按照示例进行操作,但是,我的KnowledgeAnswers始终为空
这是我的detectIntentKnowLedge的课程
class Dialogflow {
constructor(projectId) {
this.projectId = projectId;
this.sessionClient = new dialogflow.SessionsClient({
keyFilename: process.env.DIALOGFLOW_CREDINTIALS
});
}
async sendQueryToDetectKnowledge(
textMessage,
sessionId,
knowledgeBaseFullName = 'faq'
) {
const sessionPath = this.sessionClient.sessionPath(
this.projectId,
sessionId
);
const knowbase = new dialogflow.KnowledgeBasesClient({
keyFilename: process.env.DIALOGFLOW_CREDINTIALS
});
const knowledgeBasePath = knowbase.knowledgeBasePath(
this.projectId,
knowledgeBaseFullName
);
const request = {
session: sessionPath,
queryInput: {
text: {
text: textMessage,
languageCode: LANGUANGE_CODE
}
},
queryParams: {
knowledgeBaseNames: [knowledgeBasePath]
}
};
try {
const result = await this.sessionClient.detectIntent(request);
return result;
} catch (err) {
throw new error(`something error to detect version 2 beta 1`);
}
}
}
knowledgeBaseFullName值是名称知识库吗?我的知识仅被命名为faq
knowlegdeAnserw的响应始终为空
我错过了什么吗?