Dialog changes after user prompt

回眸只為那壹抹淺笑 提交于 2019-12-02 18:56:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!