botframework对话框循环node.js



我正在用botframework编写一个机器人程序。但这部分代码似乎让机器人陷入了对话循环。他一直在问同样的问题。

bot.dialog('/DentistaEndereco',[ 
function(session) {
session.send('Poderia me informar o endereço?', session.message.text); 
endereco = session.message.text;
session.endDialog();
console.log(endereco);
},function(session,results){
console.log(endereco);
session.beginDialog('showDentistas');
session.endDialog();
}
]);

我想你想问一个问题,并根据访问者的回答采取适当的行动。

bot.dialog('DentistaEndereco', [
function(session){
// ask a question to the visitor
botBuilder.Prompts.text(session, "Poderia me informar o endereço?");
},
function(session, result){
// get the response from visitor & do something
console.log(result.response);
session.beginDialog('showDentistas');
}
]);

希望,这是有用的。

最新更新