有没有办法从Microsoft Bot Builder的对话中开始对话?

时间:2018-02-25 03:50:03

标签: botframework chatbot

我尝试做的是使用Bot Builder实现一个问题树。这就是我现在所拥有的:

bot.dialog('initialDialogue', [
    function (session) {
        builder.Prompts.text(session, "What can I do for you?");
    },
    function (session, results) {
        userInput = session.message.text;

        switch(initialDialogueParse(userInput)) {
            case "error":
                session.send("I'm not sure what you're asking. I'll figure this out sometime! Try again");
                session.beginDialog('initialDialogue');
            case "changePassword":
                session.beginDialog('changePassword');
            case "deleteAccount":
                session.beginDialog('deleteAccount');
            case "changeEmail":
                session.beginDialog('changeEmail');
        }
        session.endDialog();
    }
])

initialDialogueParse方法可以正常工作并完成其工作,问题出在此之后。例如,当我输入一个提示“更改密码”的响应时。我得到的情况:

  • an"错误:未找到对话[]"控制台中的错误
  • 机器人说出来自changePassword的提示
  • 机器人然后说"哎呀。出了点问题,我们需要重新开始。"。
  • 它再次循环到initialDialogue

我想要它做的基本上是退出initialDialogue对话,并交换到changePassword对话框。然后重复此循环,直到完成提问行。

编辑:我的switch语句中没有中断。下面的答案也有效,但错误在于我没有阅读文档

0 个答案:

没有答案