如何在机器人框架中添加额外的对话框

How to add additional dialog in bot framework

如何让 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
}

我想您可以传递会话对象,然后使用该对象启动新对话。

编辑 1

你不能使用像

这样的东西吗
session.beginDialog('/getFamilyTree',{name:result.response});

然后你就可以访问像

这样的名字
args.name 

在 'getFamilyTree' 对话框中

我在 GitHub 上发布了同样的问题,并从参与开发 node.js SDK 的 Steven Ickman 那里得到了答案。答案的 link 是 https://github.com/Microsoft/BotBuilder/issues/394#issuecomment-223127365