Enums 具有枚举的bot生成器表单流

Enums 具有枚举的bot生成器表单流,enums,botframework,formflow,Enums,Botframework,Formflow,我有一个bot builder项目,使用表单流对话框,除了识别对枚举选择的响应有问题外,该对话框工作正常 [Serializable] public class ContactBot { [Template(TemplateUsage.EnumSelectOne,"How do you like to be addressed - {||}", "Please select a title to address you by - {||}")] public TitleBot?

我有一个bot builder项目,使用表单流对话框,除了识别对枚举选择的响应有问题外,该对话框工作正常

[Serializable]
public class ContactBot
{
    [Template(TemplateUsage.EnumSelectOne,"How do you like to be addressed - {||}", "Please select a title to address you by - {||}")]
    public TitleBot? Title { get; set; }

    [Prompt("What's your first name?", FieldCase = CaseNormalization.InitialUpper)]
    public String FirstName { get; set; }

    [Prompt("and your last name?", FieldCase = CaseNormalization.InitialUpper)]
    public String LastName { get; set; }

    [Prompt("I'll need your email address to confirm the appraisal")]
    [Pattern(RegexConstants.Email)]
    public String Email { get; set; }

    [Prompt("and a phone number, preferably a mobile, to contact you to arrange an appointment")]
    [Pattern(RegexConstants.Phone)]
    public String Phone { get; set; }

    public static IForm<ContactBot> BuildContactForm()
    {
        return new FormBuilder<ContactBot>()
            .Message("Firstly, can you give me some detail about yourself?")
            .Field(nameof(Title))
            .Field(nameof(FirstName))
            .Field(nameof(LastName))
            .Field(nameof(Email))
            .Field(nameof(Phone))
            .Confirm("You have provided the following: \r\r Name: {Title} {FirstName} {LastName} \r\r Email: {Email} \r\r Phone: {Phone} \r\r Is this correct? ")
            .Build();
    }
当我选择Ms、Miss或Dr时,bot会将其作为有效选项接受,并移动到下一个提示。然而,当我选择Mr或Mrs时,我被要求在Mr和Mrs之间进行选择,无论我选择什么,Mr或Mrs都不是一个标题选项——发生了什么

显示枚举的bot的图像:

对枚举选择的bot响应的图像:


这是因为bot能够在Mrs中解析Mr,因此无法在Mr和Mrs之间进行选择。因此bot请求用户建议。之后我不知道为什么它说这是一个无效的选择

或多或少的Microsoft文档:

bot如何分析表单对话框中的用户输入:

在大小写更改时中断,并在389;下划线。 生成最大长度的每n克。 添加s?到每个单词的末尾以支持复数。
我能够使用Terms属性区分Mr和Mrs

选择先生

选择夫人

在找到完整的解决方案之前,我将从枚举中删除Mrs,然后问题就会消失。对您来说,最好的解决方案可能是使用整个单词,如先生、太太、医生。它应该消除这个问题。然后,如果您愿意,您可以稍后操纵它,将其显示为Mr.Mrs.Dr.我是否可以将枚举显示为Mr,并返回一个值Mister?我得用情妇!!对于Mrs,否则Miss也会有解析问题。正如我在下面所说的,对于一个已婚女士来说,最好是删除Mrs并只使用Ms。
public enum TitleBot
{
    Mr,
    Mrs,
    Ms,
    Miss,
    Dr
}
public enum TitleBot
{
    [Terms("Mr")]
    Mr=1,
    [Terms("Mrs")]
    Mrs,
    Ms,
    Miss,
    Dr
}