I am using QnAmaker.ai for FAQ bot developed using node.js msbotframework. I want to implement few more additional features:
- Welcome message to the user when the bot connects.
- Provide scores for every answer. For e.g. Was this useful "Yes" and "No". Is there a way to store this information in the QnAmaker KB.
- Also, I have enabled chit-chat along with my custom set of question and answers. However answers from chit-chat are taking preference over the custom ones. I want the custom answers to override the chit-chat.
The code I am using as of now is very basic and picked up from the tutorial:
var previewRecognizer = new builder_cognitiveservices.QnAMakerRecognizer({
knowledgeBaseId: process.env.QnAKnowledgebaseId,
authKey: process.env.QnAAuthKey || process.env.QnASubscriptionKey
});
var basicQnAMakerPreviewDialog = new builder_cognitiveservices.QnAMakerDialog({
recognizers: [previewRecognizer],
defaultMessage: 'Sorry, I did not understand. Please say that again.',
qnaThreshold: 0.3
}
);
bot.dialog('basicQnAMakerPreviewDialog', basicQnAMakerPreviewDialog);
// Recognizer and and Dialog for GA QnAMaker service
var recognizer = new builder_cognitiveservices.QnAMakerRecognizer({
knowledgeBaseId: process.env.QnAKnowledgebaseId,
authKey: process.env.QnAAuthKey || process.env.QnASubscriptionKey, // Backward compatibility with QnAMaker (Preview)
endpointHostName: process.env.QnAEndpointHostName
});
var basicQnAMakerDialog = new builder_cognitiveservices.QnAMakerDialog({
recognizers: [recognizer],
defaultMessage: 'Sorry, I did not understand. Please say that again.',
qnaThreshold: 0.3
}
);
bot.dialog('basicQnAMakerDialog', basicQnAMakerDialog);
bot.dialog('/', //basicQnAMakerDialog);
[
function (session) {
var qnaKnowledgebaseId = process.env.QnAKnowledgebaseId;
var qnaAuthKey = process.env.QnAAuthKey || process.env.QnASubscriptionKey;
var endpointHostName = process.env.QnAEndpointHostName;
// QnA Subscription Key and KnowledgeBase Id null verification
if ((qnaAuthKey == null || qnaAuthKey == '') || (qnaKnowledgebaseId == null || qnaKnowledgebaseId == ''))
session.send('Please set QnAKnowledgebaseId, QnAAuthKey and QnAEndpointHostName (if applicable) in App Settings. Learn how to get them at https://aka.ms/qnaabssetup.');
else {
if (endpointHostName == null || endpointHostName == '')
// Replace with Preview QnAMakerDialog service
session.replaceDialog('basicQnAMakerPreviewDialog');
else
// Replace with GA QnAMakerDialog service
session.replaceDialog('basicQnAMakerDialog');
}
}
]);
Thanks