Botframework v4.暂停后以主动方式继续对话 [英] Botframework v4. Continuing a dialog in a Proactive way after pause

查看:54
本文介绍了Botframework v4.暂停后以主动方式继续对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一些瀑布步骤的普通对话框.一开始,我需要一个值,一旦用户键入了一个值,便将其放入队列(另一个应用程序将完成验证,因为这可能需要一段时间),并使用以下行停止步骤:返回新的DialogTurnResult(DialogTurnStatus.Waiting);当然,代码将对话框状态保存为天蓝色.在这件事上一切都很好.

I have a normal dialog with some waterfall steps. At the very beginning I request a value and once the user types something then I am put it into a Queue (another app will complete the validation because this could a while) and stop the steps using the following line: return new DialogTurnResult(DialogTurnStatus.Waiting); of course, the code is saving the dialogs state in a blob in azure. All good in that matter.

现在,一旦应用程序结束了该过程,我将不断使用BackgroundServices(让我们将其称为线程)读取验证状态,而且,我想知道以后如何继续该对话框.

Now, once the app ends the process, I am constantly reading the status of the validation using a BackgroundServices(let us call it a thread) and, well, I would like to know how I can continue with the dialog afterwards.

以前,我一直暂停HTTP请求,直到应用程序结束验证为止,但是等待回复的等待时间为15秒.

Previously I was pausing the HTTP request until the app ends the validation, but there is a waiting limit of 15s to response back.

所以我想找到另一种解决方案,我已经检查了C#中的主动消息"示例.以及其他有关启动对话框的示例.但是我的目标是继续下去.

So I wanted to find another solution to this, I have already checked the Proactive Message examples in C#. and some other examples about starting the dialog. But my goal is to continue with it.

我想知道这种主动功能是否只能通过API调用来完成,而不能通过and事件或类似的事情来实现.

I wonder if this proactive feature can only be accomplished from a API call and not from and event or something like that.

推荐答案

根据我对您的方案的了解,继续该对话框可能只是一条主动消息.当漫游器在瀑布中间开始执行长任务时,转弯结束.解决此问题的一种方法是,瀑布式步骤可能会带有一种提示,其中包含拒绝所有内容的验证".无论用户说什么,该机器人都可以使用请稍候"之类的东西进行响应,这基本上等同于再次提示.它不一定是实际的提示,但它是在瀑布顶部添加的对话框.然后,当通知机器人该任务已完成时,该机器人可以继续进行到瀑布的下一步.

Based on what I have understood from your scenario, continuing with the dialog can just be a proactive message. The turn ends when the bot starts the long task in the middle of the waterfall. One way of approaching this would be that the waterfall step could have a sort of prompt with a "validation" that rejects everything. Whatever the user says, the bot could respond with something like "please wait" which is essentially equivalent to a reprompt. It doesn't have to be an actual prompt, but it's a dialog added on top of the waterfall. Then when the bot gets notified that task is done, the bot could just move on to the next step of the waterfall.

实现取决于长时间运行的任务的详细信息,即任务是在bot代码本身中运行(不建议)还是在某些外部服务中运行,该服务在完成后会向bot发送通知.在这两种情况下,都可以调用DialogContext.EndDialogAsync结束该验证提示,然后瀑布将自动恢复.

The implementation depends on the details of the long-running task i.e., if the task is running in the bot code itself (not recommended) or is it running in some external service that sends a notification to the bot when it's done. In either of the cases, you can call DialogContext.EndDialogAsync to end that validation prompt, and then the waterfall will be automatically resumed.

希望这会有所帮助.

这篇关于Botframework v4.暂停后以主动方式继续对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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