Est-il possible d’avoir QnAMakerDialog
et IntentDialog
personnalisé pour fonctionner ensemble? Ainsi, QnA Maker répondra à toutes les questions de la base de connaissances concernant la FAQ et je peux également coder certaines commandes personnalisées dans BotFramework.
Quelque chose comme:
var basicQnAMakerDialog = new cognitiveservices.QnAMakerDialog({ recognizers: [recognizer], defaultMessage: 'Sorry, I did not understand that.', qnaThreshold: 0.3 }); bot.dialog('/', basicQnAMakerDialog); bot.dialog( new builder.IntentDialog() .matchesAny([/Test/i], [ function (session) { session.send('This is not from QnA Maker'); } ]) );
Ma sortie actuelle lorsque je tape ‘Test’ est le defaultMessage
de QnA maker
Je l’ai compris. Ce code m’a donné la sortie souhaitée:
var qnarecognizer = new cognitiveservices.QnAMakerRecognizer({ knowledgeBaseId: '', subscriptionKey: '', top:4}); var intentrecognizer = new builder.IntentDialog(); var intents = new builder.IntentDialog({ recognizers: [intentrecognizer, qnarecognizer] }); bot.dialog('/', intents); intents.matches('qna', [ function (session, args, next) { var answerEntity = builder.EntityRecognizer.findEntity(args.entities, 'answer'); session.send(answerEntity.entity); } ]); intents.matchesAny([/Test/i], [ function (session) { session.send('This is not from QnA Maker.'); } ]); intents.onDefault( [ function (session) { session.send('Sorry, I don\'t know that.'); } ]);