如果枚举,则 LUIS 操作绑定参数库不显示

LUIS ActionBinding Param Library doesnt display if enum

如果我指定为枚举,则它不会显示在对话框中。谁能帮忙指出是否遗漏了什么?

        [LuisActionBinding("CollPay", FriendlyName = "Reminder")]
        public class CollPayAction : BaseLuisAction
        {

            public enum PaymentAmtOptions
            {
                [Terms(new string[] { "Full Payment", "Entire Amount", "Full Due Amount" })]
                FullPayment = 1,

                [Terms(new string[] { "Clubbed Payment", "Combined Payment" })]
                CombinedPayment
            };

            [Required(ErrorMessage = "Are you planning to make a separate payment or combined one?")]
            [LuisActionBindingParam(CustomType = "BOPYMTOPTION", Order = 2)]
            [Template(TemplateUsage.EnumSelectOne, "Are you planning to make a separate payment or combined one? {||}",
                              "How would you like to make the payment - separate for each Invoice(or) clubbed with other pending dues? {||}")]
            public PaymentAmtOptions PaymentAmount { get; set; }


            public override Task<object> FulfillAsync()
            {
                var result = string.Format("Hello! You have reached the CollPay intent");

                return Task.FromResult((object)result);
            }
        }

感谢您报告此事,这确实是个问题。好消息是已经创建了 PR with a patch

一旦 PR 获得批准,您将必须更新您的代码:

-使用更新后的库 - 验证枚举值。您将在下面找到代码的样子:

[LuisActionBinding("CollPay", FriendlyName = "Reminder")]
public class CollPayAction : BaseLuisAction
{
    public enum PaymentAmtOptions
    { 
        None = 0,   // default - no option selected
        FullPayment = 1,
        CombinedPayment = 2
    };

    // custom validator for my enum value
    public class ValidPaymentAttribute : ValidationAttribute
    {
        public override bool IsValid(object value)
        {
            return value is PaymentAmtOptions &&  ((PaymentAmtOptions)value) != PaymentAmtOptions.None;
        }
    }

    [ValidPayment(ErrorMessage = "Are you planning to make a separate payment [FullPayment] or combined one [CombinedPayment]?")]
    [LuisActionBindingParam(CustomType = "BOPYMTOPTION", Order = 2)]
    public PaymentAmtOptions PaymentAmount { get; set; }

    public override Task<object> FulfillAsync()
    {
        var result = string.Format("Hello! You have reached the CollPay intent");

        return Task.FromResult((object)result);
    }
}