我在机器人框架开发工具包V3中有问题。当答案被选择时,机器人回答,机器人要求再次评分。这里有截图。
下面是我的代码:
private const string fiverate = "★★★★★";
private const string fourrate = "★★★★";
private const string threerate = "★★★";
private const string tworate = "★★";
private const string Onerate = "★";
public async Task ShowRating(IDialogContext context)
{
PromptDialog.Choice(context,this.OnOptionRating, new List<string>() { fiverate,fourrate,threerate,tworate,Onerate }," "," ",3);
}
private async Task OnOptionRating(IDialogContext context, IAwaitable<string> result)
{
try
{
string optionSelected = await result;
switch (optionSelected)
{
case fiverate:
await context.PostAsync("Five Star");
context.Done(String.Empty);
break;
case fourrate:
await context.PostAsync("Four Star");
context.Done(String.Empty);
break;
case threerate:
await context.PostAsync("Three Star");
context.Done(String.Empty);
break;
case tworate:
await context.PostAsync("Two Star");
context.Done(String.Empty);
break;
case Onerate:
await context.PostAsync("One Star");
context.Done(String.Empty);
break;
}
}
catch (TooManyAttemptsException ex)
{
await context.PostAsync($"Ooops! Too many attemps :(. But don't worry, I'm handling that exception and you can try again!");
context.Wait(this.MessageReceivedAsync);
}
}
有没有更好的解决方案?我从堆栈溢出中引用了这么多样本,但仍然没有找到解决方案。
谢谢。
发布于 2019-03-26 11:07:59
我对瀑布模型进行了修改。它解决了我的问题。谢谢。
https://stackoverflow.com/questions/55312256
复制相似问题