微软Botframework Prompts.choice没有得到validation响应

我正在使用chatconnector将我的Bot连接到前端聊天应用程序,并将机器人的响应写入我自己的数据库。 问题是,当我validation提示机器人响应,但没有API让我抓住validation响应。

 bot.dialog('/', [ function (session) { builder.Prompts.choice(session, "Which color?", "red|green|blue"); }, function (session, results, next) { //after the user respond, the bot validates the input, if it's not //one of the choices, this next function in the waterfall doesn't //even run, therefore I have no way to write the bot response //into my own chat database and render it for the user }]) 

无论如何,我可以抓住机器人对失败validation的回应吗?

简短的回答:不。

长答案:这不是SDK的function。 如果对select提示的input响应与任何提供的选项(即“意图”)不匹配,则瀑布对话不会进行到步骤2,因为没有匹配响应。 系统devise是警告用户,并等待他们input一个提供的select名称或编号(取决于频道)。 例如。 如果答案不符合任何选项,框架会提示用户“我不明白,请从列表中select一个选项”。 直到input有效的选项。

黑客答案:您需要修改SDK以满足您在这种情况下的需求,然后使用您的自定义版本的SDK部署您的机器人。 您正在寻找的文件是Microsoft / BotBuilder / Node / core / src / dialogs / PromptChoice.ts