问题
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.
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.
Previously I was pausing the HTTP request until the app ends the validation, but there is a waiting limit of 15s to response back.
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.
I wonder if this proactive feature can only be accomplished from a API call and not from and event or something like that.
回答1:
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.
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.
Hope this helps.
来源:https://stackoverflow.com/questions/57717800/botframework-v4-continuing-a-dialog-in-a-proactive-way-after-pause