bot框架 - 静态菜单
我正在使用Bot Framework(C#)创建聊天机器人,我在OnTurnAsync方法上添加了建议的操作,以显示用户作为菜单,但是当我运行机器人时,建议的操作方法将为每个活动运行,并将菜单显示为用户以来,由于我在OnTurnAsync方法中调用了它,因此是否有任何方法或方法可以将此建议的菜单添加为静态菜单,或者在用户加入对话时仅加载一次(请注意,我尝试在OnMemberAddedEdasync方法中拨打它,但是它显示了只有在开始时就消失了,随着操作的继续)。
Im creating a chatbot using bot framework (c#), I have added a suggested actions on onturnasync method to show up to the user as a menu, but when i run the bot the suggested actions method will run for each activity and show the menus to the user since i called it in onturnasync method, is there any method or way i can add this suggested menu as a static or to load only once when the user joins the conversation, (note I tried called it in onmemberaddedasync method , but it shows only at the starting and disappears as the operation continues).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能制作此“静态菜单”的方式是使用中间件。
目前,我有一个最初为网络聊天开发的聊天机器人。后来有一些冲刺,客户要求包括MS Teams频道。这给我带来了一些问题,因为不支持建议的某些功能。因此,当机器人位于MS Teams频道中时,我使用中间件用英雄卡代替了建议的动作。
我在您的位置要做的是创建一个中间件,并在发送之前将您的静态菜单附加到消息上。
您可以检查文档以获取有关 Middlewares。
如果我本周有一些空闲时间,我将创建一个简单的机器人来显示如何做到。
最良好的问候!
更新25/6/2022
我使用示例bot 在这里
三个组件对话框:
,以了解中间件的工作方式, ://github.com/sempjc/botwithstaticmenu/blob/master/staticmenubot/staticmenumiddleware.cs“ rel =“ nofollow noreferrer”> staticmenumiddleware 。
如何在您的项目中复制它?
use(< middleware_variable>)
,其中midderware_variable
是您的依赖关系的名称。希望此示例代码结果对每个人有帮助。
如果出现任何问题,我将尽快回答。
The way I probably make this "Static Menu" is using a middleware.
Currently I have a chatbot originally developed for a Webchat. Some sprint later, client requested to include MS Teams Channel. That create me some problems, because some features like suggested action is not supported. So I used middleware to replace suggested actions with Hero Cards, when bot is in MS Teams Channel.
What I do in your place is create a middleware and append your static menu to the message before send.
You can check the documentation for more details about middlewares.
If I have some free time this week, I will create a simple bot to show how you can do it.
Best regard!
Update 25/6/2022
I created a repository with a sample bot here
The sample bot is a bot with three component dialogs:
To understand how the middleware work go to StaticMenuMiddleware.
How to replicate this in your project?
Use(<middleware_variable>)
, wheremiddleware_variable
is the name of your dependency.Hope this sample code result helpful to everyone.
If any question arise, I will try to answer as soon as possible.