首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Prompt.Choice中的重复评级

Prompt.Choice中的重复评级
EN

Stack Overflow用户
提问于 2019-03-23 17:16:02
回答 1查看 401关注 0票数 0

我在机器人框架开发工具包V3中有问题。当答案被选择时,机器人回答,机器人要求再次评分。这里有截图。

下面是我的代码:

代码语言:javascript
复制
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);
    }
}

有没有更好的解决方案?我从堆栈溢出中引用了这么多样本,但仍然没有找到解决方案。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2019-03-26 11:07:59

我对瀑布模型进行了修改。它解决了我的问题。谢谢。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55312256

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档