问题
There. I am trying to implement Proactive Waterfall dialog to start dialog from external service.
I have implemented CompoenentDialog
called SimpleDialogWithCardAndActions
, configured it in IBot
and now I can start this dialog manually and continue dialog after clicking buttons. It works fine as expected.
Then I have created Controller's action method which is starts proactive dialog
private async Task BotCallback(ITurnContext turnContext, CancellationToken cancellationToken)
{
var conversationStateAccessors = conversationState.CreateProperty<DialogState>(nameof(DialogState));
var dialogs = new DialogSet(conversationStateAccessors);
var dialogAccessor = conversationState.CreateProperty<SimpleDialogWithCardAndActionsState>(nameof(SimpleDialogWithCardAndActionsState));
dialogs.Add(new SimpleDialogWithCardAndActions(dialogAccessor));
var dc = await dialogs.CreateContextAsync(turnContext, cancellationToken);
var results = await dc.ContinueDialogAsync(cancellationToken);
if (results.Status == DialogTurnStatus.Empty)
{
await dc.BeginDialogAsync(nameof(SimpleDialogWithCardAndActions), null, cancellationToken);
await conversationState.SaveChangesAsync(dc.Context, false, cancellationToken);
}
await userState.SaveChangesAsync(turnContext, false, cancellationToken);
await conversationState.SaveChangesAsync(turnContext, false, cancellationToken);
}
This code successfully executed and display card as expected and I can even tap button and send an activity and handle it in IBot
, but it does not continue waterfall dialog within await dc.ContinueDialogAsync(cancellationToken);
. I guess that context is lost, but as you can see above, I have saved ConvesationState
which is also injected to both IBot
and Controller as a Singletone.
So my question is: Is it possible to continue proactive waterfall dialog in IBot
if it was started within IBotFrameworkHttpAdapter from controller? If it is possible, how can I do that and what I did wrong?
FYI: IBotFrameworkHttpAdapter
is used only to access ITurnContext
and start dialog and IBot
does not use it. Is it possible that I should use same BotAdapter
instance for both notify Controller and IBot
implementation?
UPD: I have change Bot-To-Controller binding mechanism and now IBot
and NotifyController
are using same singleton IBotFrameworkHttpAdapter
and that is have no effect. Issue still relevant
来源:https://stackoverflow.com/questions/61885871/proactive-waterfall-dialog-dont-continue-in-microsoft-bot