问题
I have a dialog as follows to get user name and password from user
bot.dialog('/getUsernamePassword', [
function (session) {
builder.Prompts.text(session, 'Please enter your username');
},
function (session, results) {
session.userData.name = results.response;
builder.Prompts.text(session, 'Please enter your password');
},
function (session, results) {
session.userData.password = results.response;
session.endDialogWithResult(results);
}
]);
After user enter username, my dialog doesn't continue, instead it goes to root dialog and prints "I didn't understand please try again"(default message)
Can anyone help me to understand what I am doing wrong here?
my recognizers are configured as follows
var model = 'https://westus.api.cognitive.microsoft.com/luis/..;
var recognizer = new builder.LuisRecognizer(model);
bot.recognizer(recognizer);
// Add regular expression recognizer to bot
var helpRecognizer = new builder.RegExpRecognizer('HelpIntent', /^(help|options)/i);
var cancelRecognizer = new builder.RegExpRecognizer( "CancelIntent", /^(cancel|nevermind)/i);
bot.recognizer(helpRecognizer);
bot.recognizer(cancelRecognizer);
var intents = new builder.IntentDialog({ recognizers: [helpRecognizer,cancelRecognizer,recognizer] });
回答1:
I think that what is happening is that your response is going through LUIS
.
In order to avoid this, update your definition of the LuisRecognizer
to be the following:
var model = 'https://westus.api.cognitive.microsoft.com/luis/..;
var recognizer = new builder.LuisRecognizer(model).onEnabled((context, callback) => {
var enabled = context.dialogStack().length === 0;
callback(null, enabled);
});
bot.recognizer(recognizer);
来源:https://stackoverflow.com/questions/44354323/dialog-changes-after-user-prompt