我有一个如下对话框,用于从用户
获取用户名和密码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);
}
]);
用户输入用户名后,我的对话框不会继续,而是转到root对话框并打印"我不明白,请再试一次"(默认消息)
有谁能帮我理解我在这里做错了什么?
我的识别器配置如下
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] });
答案 0 :(得分:1)
我认为发生的事情是您的回复正在通过LUIS
。
为了避免这种情况,请将LuisRecognizer
的定义更新为以下内容:
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);