I have a custom WaterfallDialog and one of the steps prompts the user to fill a variable set of options in a dish (for restaurants).
The problem is that I want the card to be generated dynamically: Depending on the selected dish, the amount of Input.ChoiceSets will vary. I mean, the layout of the cad itself will vary depending on the dish type.
My call to the make the prompt is like this:
private async Task<DialogTurnResult> ConfigureDishStep(WaterfallStepContext stepContext, CancellationToken cancellationToken)
{
return await stepContext.PromptAsync("ConfigureDish", new PromptOptions(), cancellationToken);
}
But as you see, the PromptAsync
calls the prompt using the dialogId
("ConfigureDish") that has to be registered within the parent dialog using AddDialog. This leaves no way to configure the card depending on the dish type. If I have to register each prompt before using it, and this is done inside the constructor of the parent dialog:
AddDialog(new AdaptiveCardPrompt(ConfigureDish, CreateAdaptiveCardPromptSettings()));
Then how to provide a dynamically generated card for each of the ConfigureDishStep
?
While it's great to see people using Michael Richardson's Adaptive Card prompt, it unfortunately is different from other prompts in that it uses an immutable attachment created at the time of construction. It makes sense in a way for the Adaptive Card prompt to only allow one specific card to be used, but it makes it difficult to do what you're trying to do using that class. I can think of a few options for you:
You may be interested in reading my blog post for more information: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/