Reputation: 107
so I'm trying to call a different dialog from my luis dialog. When I do this, I expect the luis dialog to wait until the other dialog has finished.
Since I cannot show you my real project, I've used the Luis Dialog Sample to reproduce my problem. I've added another step to the PromptWaterfallDialog which looks like this now:
public PromptWaterfallDialog()
: base(nameof(PromptWaterfallDialog))
{
// This array defines how the Waterfall will execute.
var waterfallSteps = new WaterfallStep[] // 20190813 FPI diese Schritte werden jedes Mal ausgeführt wenn ein PromptWaterfallDialog aufgerufen wird
{
this.AskQuestionStepAsync,
this.ReturnResultStepAsync,
this.TestStepAsync
};
// Add named dialogs to the DialogSet. These names are saved in the dialog state.
this.AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
this.AddDialog(new TextPrompt(nameof(TextPrompt)));
// The initial child Dialog to run.
this.InitialDialogId = nameof(WaterfallDialog);
}
private async Task<DialogTurnResult> AskQuestionStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
var options = stepContext.Options as PromptDialogOptions;
return await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text(options.Prompt) }, cancellationToken);
}
private async Task<DialogTurnResult> ReturnResultStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
return await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text("Hi") }, cancellationToken);
}
private async Task<DialogTurnResult> TestStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
var options = stepContext.Options as PromptDialogOptions;
options.Result = stepContext.Result as string;
await stepContext.Context.SendActivityAsync(MessageFactory.Text("This is just a test"));
return await stepContext.EndDialogAsync(new DialogTurnResult(DialogTurnStatus.Complete, options));
}
As you can see, I've added the TestStepAsync. I would expect the dialog to go like this:
Bot: PromptMessage (AskQuestionStepAsync)
User: some answer ...
Bot: Hi (ReturnResultStepAsync)
User: some input...
Bot: This is just a test (TestStepAsync)
But apparently, the bot skips waiting for the second user input and goes straight to the TestStepAsync as you can see here:
Does anyone know if this kind of behavior is intented or not? And how do I get the bot to work like I expect it to do?
I'm using the Bot Emulator version 4.6.0.
Upvotes: 1
Views: 73
Reputation: 441
Instead of
Prompt = MessageFactory.Text("Hi")
change it to:
Prompt = MessageFactory.Text("Hi", InputHints.ExpectingInput);
Upvotes: 1