我正在使用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
}
答案 0 :(得分:2)
根据文档,这是预期的行为,因为FormFlow
将在任何其他选项中找到输入的术语时尝试消除歧义。在这种情况下,Central US是第二条消息中显示的其他选项的一部分。
解决此问题的方法是使用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选项相同的问题。