I'm trying to integrate luis with a working QNA active learning bot. I have created intents dialog with Luis and QNA dialogs
var luisRecognizer = new builder.LuisRecognizer(config.luisEndPoint)
luisRecognizer.onFilter(function(context, result, callback) {
if (result.intent != 'None' && result.score < 0.8) {
callback(null, { intent: 'None', score: 0});
} else {
callback(null, result);
}
});
const qnaRecognizer = new cognitiveServices.QnAMakerRecognizer({
knowledgeBaseId: process.env.KBID,
endpointHostName: process.env.HOST_NAME,
authKey: process.env.SUBSCRIPTION_KEY,
top: 4
});
var feedbackTool = new feedbackTool.FeedbackTool();
bot.library(feedbackTool.createLibrary());
const qnaMakerDialog = new cognitiveServices.QnAMakerDialog({
recognizers: [qnaRecognizer],
defaultMessage: DefaultMessageQNA,
qnaThreshold: qnaThreshold,
feedbackLib:feedbackTool
});
var intentsDialog = new builder.IntentDialog({ recognizers: [luisRecognizer, qnaMakerDialog ] });
bot.dialog('/', intentsDialog);
and based on luis results iam calling dailogs as
intentsDialog.matches("someIntent", [someIntent.getDialog()]);
intentsDialog.matches("anotherIntent", [anotherIntent.getDialog()]);
intentsDialog.matches('qna', [
function (session, args, next) {
//problem 1
qnaMakerDialog.invokeAnswer(session, args, qnaThreshold, defaultMessageQNA)
}
]);
intentsDialog.onDefault( [
function (session) {
//problem 2
session.send('Sorry, I don\'t know that.');
}
]);
This code gives right results for a valid QNA and redirects to appropriate dialog based on luis intent.
But I am facing 2 challenges in the above code:
- when intentsDialog matches qna, and qna doesnt have a straight ans and gives options to select. In this case i'm unable to capture user selected option and send it to qna active learning code.( Im overriding qnaMakerDialog.defaultWaitNextMessage for storing new questions to KB )
- When intentsDialog doesnt match qna and luis, even in this scenario i want that data to be send to qna active learning part but unable to send it.
Is there any other way like without using IntentDialog and forwarding context to qna. Thanks in advance.