避免在瀑布对话框期间中断 [英] Avoiding Interrupts During a Waterfall Dialog

查看:70
本文介绍了避免在瀑布对话框期间中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Microsoft机器人程序框架中有一个瀑布对话框,向用户询问一些问题,例如地理,公司等.我还有另一个对话框,当LUIS意图与GetCompanyNews匹配时会触发该对话框.

I have a waterfall dialog in my Microsoft bot framework which asks the user several questions like geo, company, etc. I have another dialog which gets triggered when the LUIS intent matches GetCompanyNews.

我在模拟器中观察到,当用户在瀑布对话中输入公司名称时,它将触发另一个对话框,并且瀑布对话框将被替换.

I observed in the emulator that when the user types company name during the waterfall conversation, it triggers the other dialog and the waterfall dialog gets replaced.

这是预期的行为吗?如果是,那么有什么方法可以防止中断瀑布对话框?

Is this the expected behavior? If yes, then is there any way to prevent interruptions to the waterfall dialog?

推荐答案

在GitHub上有类似的情形,位于

There is a similar scenario at GitHub at https://github.com/Microsoft/BotBuilder/issues/2670. From which we can found that, the root cause should be:

据我所知,您在机器人级别具有识别器(也可以在库和对话框级别使用它们).当漫游器处理响应(即使在提示对话框期间)时,它需要知道将其路由到哪里,这就是所有根识别器都在运行的时候.

As I see you have a recognizer at bot level (you can also have them on library and dialog levels). When the bot handles a response (even during a prompt dialog) it needs to know where to route it and that's when all root recognizers are run.

而且我们还有一个解决方案,需要bot SDK版本大于3.8

And also we have a solution which need the bot SDK version is greater then 3.8,

在3.8中,贡献者添加了使用新的onEnabledonFilter方法来自定义识别器的功能.这是添加一个过滤器的示例,该过滤器在任务运行时会禁用识别器:

In 3.8 the contributor added the ability to customize recognizers using new onEnabled and onFilter methods. Here's an example of adding a filter which disables the recognizer anytime a task is running:

var recognizer = new builder.LuisRecognizer('<model>').onEnabled(function (context, callback) {
     var enabled = context.dialogStack().length == 0;
     callback(null, enabled);
});

这篇关于避免在瀑布对话框期间中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆