机器人甚至在静态按钮上要求澄清

Bot asks for clarification even on static buttons

我正在使用 BotFramework FormFlow。其中一个问题给出了一个静态的选项列表,用户可以从中进行选择。例如,当用户选择 Central Us 时,它仍然要求澄清,有没有办法避免这种情况,因为用户选择的内容很清楚。

代码如下:

        [Prompt("Please choose the region in which the cluster should be created {||}")]
    public RegionOptions? DesiredGeoRegion;


    public enum RegionOptions
   {
    AustraliaEast,
    AustraliaSoutheast,
    BrazilSouth,
    CanadaCentral,
    CanadaEast,
    CentralIndia,
    CentralUS,
    EastAsia,
    EastUS,
    EastUS2,
    JapanEast,
    JapanWest,
    NorthCentralUS,
    NorthEurope,
    SouthCentralUS,
    SouthIndia,
    SoutheastAsia,
    UKNorth,
    UKSouth2,
    WestCentralUS,
    WestEurope,
    WestIndia,
    WestUS,
    WestUS2
   }

根据文档,这是预期的行为,因为 FormFlow 将尝试消除在任何其他选项中也找到输入的术语时的歧义。在这种情况下,美国中部是第二条消息中显示的其他选项的一部分。

克服此问题的一种方法是使用 Terms attribute 覆盖用于将枚举值与用户输入匹配的默认术语。我尝试了这个并且它按预期工作:

public enum RegionOptions
{
    AustraliaEast,
    AustraliaSoutheast,
    BrazilSouth,
    CanadaCentral,
    CanadaEast,
    CentralIndia,
    CentralUS,
    EastAsia,
    EastUS,
    EastUS2,
    JapanEast,
    JapanWest,
    [Terms("North Central US")]
    NorthCentralUS,
    NorthEurope,
    [Terms("South Central US")]
    SouthCentralUS,
    SouthIndia,
    SoutheastAsia,
    UKNorth,
    UKSouth2,
    [Terms("West Central US")]
    WestCentralUS,
    WestEurope,
    WestIndia,
    WestUS,
    WestUS2
}

请注意,您将看到 EastUS 和 WestUS 选项的相同问题。