gpt4 book ai didi

botframework - Formflow 机器人与枚举答案位置与答案文本混淆

转载 作者:行者123 更新时间:2023-12-01 07:51:07 26 4
gpt4 key购买 nike

我有一个表单流对话框,其中将以下问题定义为枚举

public enum PreviousOwnerOptions
{
[Describe("Owned from new")]
[Terms("0", "new", ".*[O|o]wned from new")]
OwnedFromNew = 0,

[Terms("1", "One")]
One,

[Terms("2", "Two")]
Two,

[Terms("3", "Three")]
Three,

[Terms("4", "Four")]
Four,

[Terms("5", "Five")]
Five,

[Terms("6", "Six")]
Six,

[Describe("More than six")]
[Terms(".*More than six", "more")]
MoreThanSix
}

这是问题对用户的显示方式......

enter image description here

我的问题是,如果你输入数字“3”作为答案,那么响应是这样的......

enter image description here

看起来机器人不确定我是指位置 3 的答案,还是答案“三”。我以为 Terms属性会负责澄清吗?

请问我该如何解决?

最佳答案

这是由于两件事的结合而发生的。

首先,您尝试在看似不可为空的字段上使用 0 Enum 值。在这种情况下,0 值保留为空值。来自 formflow docs page :

Any of the data types may be nullable, which you can use to model that the field does not have a value. If a form field is based on an enumeration property that is not nullable, the value 0 in the enumeration represents null (i.e., indicates that the field does not have a value), and you should start your enumeration values at 1. FormFlow ignores all other property types and methods.



第二部分是因为您在条款属性中使用了 1,2,3 等数值,例如 [Terms("1", "One")]默认情况下,formflow 会尝试将这些值与正确的枚举对齐。所以我认为正在发生的是,它让您选择示例中使用的“3”,因为 3 是您的术语之一 [Terms("3", "Three")]它为您提供了这些选择。但在零索引枚举值中,由于0被保留,实际枚举值 [Terms("2", "Two")] Two,是 3。所以它不知道你的意思。

因此,为了使用这些术语使其正常工作,将是这样的:
    public enum PreviousOwnerOptions
{
[Terms("1", "One")]
One=1,

[Terms("2", "Two")]
Two,

[Terms("3", "Three")]
Three,

[Terms("4", "Four")]
Four,

[Terms("5", "Five")]
Five,

[Terms("6", "Six")]
Six,

[Describe("More than six")]
[Terms(".*More than six", "more")]
MoreThanSix,

[Describe("Owned from new")]
[Terms("new", ".*[O|o]wned from new")]
OwnedFromNew
}

关于botframework - Formflow 机器人与枚举答案位置与答案文本混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51058051/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com