Botframework在使用当前的“意图对话框"完成之前,不会从其他“意图对话框"中中断 [英] Botframework No Interruptions from other Intent Dialogs until done with current Intent Dialog
问题描述
我打算使用LUIS.ai来实现A和B.目的A我正在使用builder.Prompts.text
询问用户几个问题.但是,有时取决于答案,它会切换到意图B.我猜想它恰好与我的意图B相匹配,即使我认为不应该.有办法防止这种情况发生吗?如果我正在通过意图A的对话框,那么在完成之前,我不希望其他意图引起任何干扰.这是我的代码示例.
I've intent A and B using LUIS.ai. In intent A I'm using builder.Prompts.text
to ask user couple questions. However, sometimes depending on the answer it would switched to intent B. I'm guessing it happens to match with my intent B even though I think it shouldn't. Is there a way to prevent this from happening? If I'm going through intent A's dialogs, I don't want any interruptions from other intents until I'm done. Here is an example of my code.
bot.dialog('A', [
function (session, args, next) {
...
},
function (session, args, next) {
...
},
function (session, args) {
...
}
]).triggerAction({
matches: 'A'
});
bot.dialog('B', [
function (session, args, next) {
...
},
function (session, args, next) {
...
},
function (session, args) {
...
}
]).triggerAction({
matches: 'B'
});
推荐答案
这就是triggerAction
对您的作用.它们可以非常方便地使您的对话框保持打开状态( http://www. pveller.com/smarter-conversations-part-2-open-dialogs ),但在您的情况下,它们会妨碍您的操作.
That's what triggerAction
s do to you. They can be very handy to keep your dialogs open (http://www.pveller.com/smarter-conversations-part-2-open-dialogs) but in your case they get in the way.
如果您将对话框置于IntentDialog
下,则可以使它们保持对全局路由系统的免疫.如果您要做的只是A
和B
,那么这将等效于您的代码:
You can keep your dialogs immune to the global routing system, if you place them under the IntentDialog
. If all you do is A
and B
, then this would be an un-interruptible equivalent of your code:
const intents = new builder.IntentDialog({
recognizers: [
new builder.LuisRecognizer(process.env.LUIS_ENDPOINT)
]
});
intents.matches('A', 'A');
intents.matches('B', 'B');
bot.dialog('/', intents);
bot.dialog('A', []);
bot.dialog('B', []);
这篇关于Botframework在使用当前的“意图对话框"完成之前,不会从其他“意图对话框"中中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!