提示选择中的重复评分 [英] Duplicate Rating in Prompt.Choice

查看:76
本文介绍了提示选择中的重复评分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Bot Framework SDK V3中有问题. 选择答案后,漫游器会回复,并且漫游器会要求再次评分. 这里是截图. 而这里是我的代码:

I had Question in Bot Framework SDK V3. When the answer is selected, then the bot reply and the bot ask to rate again. Here with the screenshot. and Here with my code:

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);
    }
}

有什么更好的解决方案吗?我从Stack Overflow引用了很多示例,但仍未找到解决方案.

any solutions better for this? I had reference so many sample from Stack Overflow, but still not found the solutions.

谢谢.

推荐答案

我已更改为瀑布模型.它解决了我的问题.谢谢.

I had change to the waterfall model. Its solved my problems. Thank you.

这篇关于提示选择中的重复评分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆