【发布时间】:2016-08-31 08:51:43
【问题描述】:
如何同时进行 2 个对话?我目前正在使用 TextBot 和 LuisDialog 来构建一个机器人。我首先与用户进行对话以获取数据。然后在以不同的方法进行一些处理时,我发现我需要来自用户的额外信息。我如何才能与用户创建新对话以获取附加信息?我在下面有一些代码试图显示我想要做什么。感谢您的建议。
文件 1:foo.js
var dialog = new builder.LuisDialog(model);
var sonnyBot = new builder.TextBot();
sonnyBot.add('/', dialog);
dialog.on('intent_1', [
function(session, args, next) {
name = builder.Prompts.text(session,"What is your name?");
},
function(session, result) {
session.dialogData.name= results.response;
getFamilyTree(session.dialogData.name);
}
]);
文件 2:getFamilyTree.js
function getFamilyTree(name) {
find family tree for name
if (need place of birth) {
begin new dialog
prompt user place of birth
get place of birth from user
end dialog
}
finish getting the family tree
}
【问题讨论】:
标签: node.js botframework