主动中断 [英] Proactive Interruptions

查看:87
本文介绍了主动中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Azure功能将主动消息发送到客户端.发送主动消息后,如何重置"对话.

I am using an Azure Function to send a Proactive message to the client. How do i "reset" a conversation when a Proactive message is sent.

在机器人内部,可能会提示用户输入某些内容(例如一天中的时间).在他们做出响应之前,可能会向他们发送一条主动消息.在这种情况下,我想重置/取消上一个对话框并重新开始.

Within the bot, a user might be prompted for something (ex. time of day). A proactive message may get sent to them before they respond. In this scenario, I would like to reset/cancel the previous dialog and start fresh.

我已经能够使用CancelAllDialogsAsync重置对话框,该对话框对于用户驱动的消息很好用.

I am already able to reset the dialog using CancelAllDialogsAsync which works fine for user-driven messages.

我正在使用ConnectorClient发送主动消息,该消息绕过了框架,并直接发送到客户端,因此从不打我的中间件来重置对话框.

I am sending my proactive message using ConnectorClient, which bypasses the framework, and sends directly to the client, thus never hitting my middleware to reset the dialog.

如何将主动消息发送到框架(我可以毫无问题地从bot发送响应)

How can I get the proactive message sent to the framework (i can send the response from the bot no problem)

推荐答案

我强烈建议您通过让函数在ConversationReference上下文中通过ConnectorClient向bot发送回传事件来解决此问题.这样,机器人就可以维护状态的所有详细信息以及该事件发生时应发生的情况的所有权,而不是该责任泄漏给功能.然后,该漫游器会监视此自定义事件并对其进行响应,但是它认为合适.

I would highly recommend you solve this by having your function send your bot a backchannel event under the context of the ConversationReference via the ConnectorClient. This way the bot maintains ownership for all the details about state and what should happen when this event occurs rather than that responsibility leaking to the function. The bot then watches for this custom event and responds to it however it sees fit.

如果您需要更多详细信息,请告诉我,我将更新答案.

If you need any more details let me know and I'll update my answer.

这篇关于主动中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆