I´m using the class Microsoft.Bot.Builder.Dialog.Promptoptions that takes a ResumeAfter which is delegate and requires (IDialogContext context, IAwaitable result)
However, the delegate I want to call is a not of private async Task Test (IDialogContext context, IAwaitable result)
but rather a LUIS delegate that has the following
[LuisIntent("Test") private async Task Test (IDialogContext context, LuisResult result)
It will be highly appreciated to hear some thoughts how to call the LUIS attributed method
private async Task ProductChoice(IDialogContext context, IAwaitable<string> result)
{
PromptDialog.Choice<string>(
context,
ProductOverview,
this.productOptions,
"Which plaform are you interested in?",
"Ooops, what you wrote is not a valid option, please try again",
3,
PromptStyle.PerLine);
await context.PostAsync(context.MakeMessage());
}
[LuisIntent ("Products")]
public async Task ProductOverview(IDialogContext context, LuisResult result)
{
string product = "";
EntityRecommendation rec;
Activity activity = (Activity)context.MakeMessage();
Attachment attachment;
if (result.TryFindEntity("ProductName", out rec))
{
//Here you could include other rich cards
attachment = CreateNewHeroCard(product = rec.Entity);
activity.Attachments.Add(attachment);
await context.PostAsync(activity);
}
else
{
await context.PostAsync("Sorry, their is no product by that name");
}
}
First, what you are trying to do is not possible.
Then a few other things:
PostAsync
after calling a Prompt
. LUIS
Intent method, then you need to extract that logic into a common method that both, LUIS and the ResumeAfter method of the prompt can call to. Of course, that common method shouldn't have anything related to LuisResult
, since that won't be available in the ResumeAfter method. When the ResumeAfter method will be called; LUIS won't be called. LUIS
after the prompt, then a bit more code will have to be written but it's doable ProductOverview
method from the ResumeAfter method, you can just do it as a standard method, however (and again), have in mind that you won't have a LuisResult there, so you will have to send a null value and handle that accordingly in your ProductOverview
method. Something like:
private async Task ProductChoice(IDialogContext context, IAwaitable<string> result)
{
PromptDialog.Choice<string>(
context,
AfterPromptChoiceMethod,
this.productOptions,
"Which plaform are you interested in?",
"Ooops, what you wrote is not a valid option, please try again",
3,
PromptStyle.PerLine);
await context.PostAsync(context.MakeMessage());
}
private async Task AfterPromptChoiceMethod(IDialogContext context, IAwaitable<string> result)
{
await ProductOverview(context, null);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.