更新时间:2023-11-19 10:41:04
好吧,我让它与2种不同的QnA服务一起运行.我发现的唯一解决方案是调用REST服务,而不使用识别器.
Well, I got it running with 2 different QnA services. The only solution I found was to make a call to the REST service instead of using the recognizer.
以下是手动调用一项服务的代码:
Here is the code to make a manual call to one service:
var fetch = require('node-fetch');
require('dotenv-extended').load({
path: '../.env'
});
var get_restQnA = function (question, callback){
qnaurl=`https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/${process.env.KB_ID}/generateAnswer`;
fetch(qnaurl, {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Ocp-Apim-Subscription-Key": process.env.QNA_KEY
},
body: JSON.stringify({
"question": question,
"top": 1
})
}).then(response => {
return response.json();
}).then(data => {
console.log('Here is the data: ', data);
}).catch(err => {console.log(err);});
}
module.exports.get_restQnA = get_restQnA;
由于您使用的是唯一的服务ID,因此只需以不同的方式调用LUIS即可调用每个服务.
Since you are using the unique service ID, you just have to call each service in the different intents you have for LUIS.