Botframework在使用当前的“意图对话框"完成之前,不会从其他“意图对话框"中中断

编程入门 行业动态 更新时间:2024-10-18 14:19:20
本文介绍了Botframework在使用当前的“意图对话框"完成之前,不会从其他“意图对话框"中中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我打算使用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对您的作用.它们可以非常方便地使您的对话框保持打开状态( www. pveller/smarter-conversations-part-2-open-dialogs ),但在您的情况下,它们会妨碍您的操作.

That's what triggerActions do to you. They can be very handy to keep your dialogs open (www.pveller/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在使用当前的“意图对话框"完成之前,不会从其他“意图对话框"中中断

本文发布于:2023-11-17 12:37:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1610026.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框   意图   Botframework   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!