Avoiding Interrupts During a Waterfall Dialog

我们两清 提交于 2019-12-13 04:20:55

问题


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?


回答1:


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.

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

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);
});


来源:https://stackoverflow.com/questions/47723611/avoiding-interrupts-during-a-waterfall-dialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!