问题
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
andonFilter
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