Over the holiday weekend, I've been trying to get a bot working using the Microsoft Bot Framework. I'm using version 3.9.1 of the botbuilder package for Node.js.
I've created an app and model at www.luis.ai. I have been able to successfully test my intents via the "Train & Test" feature. Then, in my actual Node code, I have the following:
let connector = new BotBuilder.ChatConnector({
appId: 'myId',
appPassword: 'myAppSecret'
});
let bot = new BotBuilder.UniversalBot(connector);
let luis = new BotBuilder.LuisRecognizer('myLuisAppUrl');
let intent = new BotBuilder.IntentDialog({ });
intent.recognizer(luis);
intent.matches('Intent.1', '/execute-report');
intent.matches('Intent.2', '/execute-batch-job');
intent.onDefault('/unknown');
bot.dialog('/', intent);
bot.dialog('/execute-report', [function(session, args, next) {
var result = ((Date.now() % 2) === 0) ? 'Report Ran!' : 'Failed';
session.send(result);
}]);
bot.dialog('/execute-batch-job', [function(session, args, next) {
var result = ((Date.now() % 2) === 0) ? 'Batch Job Ran!' : 'Unable to run Batch Job';
session.send(result);
}]);
bot.dialog('/unknown', [function(session, args, next) {
session.send('What did you ask for?');
}]);
When interacting with my bot, I always get "What did you ask for?". In other words, at this point, I know that:
- I can successfully interact with my bot. However, the
/unknown
dialog is always being called, which is not the correct interaction. My model in LUIS looks correct:
a. If I enter "Run Report" in the LUIS.ai Test app, the top scoring intent is "Intent.1"
b. If I enter "Execute Batch Job" in the LUIS.ai Test app, the top scoring intent is "Intent.2"
However, my bot is not sending the appropriate response. The /execute-report
and /execute-batch-job
dialogs are never used, even though they should be. I don't understand what I'm doing wrong. To me, I believe I've setup my bot correctly. I don't see what I'm doing wrong. Can someone please tell me what I'm doing wrong? Is there a way to see the response returned from LUIS in my Node code similar to what's seen in the "Test" app at LUIS.ai