更改 botframework Formflow 中的确认选项
Change Confirm options in botframework Formflow
我在 botframework 中创建了一个表单流。我想更改确认选项,默认情况下需要 'Yes' 和 'No'。但我希望它继续 'Yes',即使用户输入 'OK'、'Ya'、'Yeah' 等。我如何添加确认选项
您需要将新条款添加到 FormBuilder 配置的 Yes
数组中。类似于:
public static IFormBuilder<T> CreateCustomForm<T>()
where T : class
{
var form = new FormBuilder<T>();
var yesTerms = form.Configuration.Yes.ToList();
yesTerms.Add("Ya");
form.Configuration.Yes = yesTerms.ToArray();
return form;
}
那你就可以像这样使用了:
return CreateCustomForm<MyForm>()
原因如下:
Confirmation field, set it's type to bool. At some point, a recognizer is defined for the field, based on it's type. In this, case, the Confirmation
field will use the RecognizeBool 识别器。
识别器使用 Yes/No arrays defined in the form's configuration (which initially they are retrieved from the resource file) for doing the parsing.
将Confirmation
字段添加到Form后,a ConfirmStep step is also added. The ConfirmStep is the one that later in the game ends up calling the recognizer进行词条匹配解析
我在 botframework 中创建了一个表单流。我想更改确认选项,默认情况下需要 'Yes' 和 'No'。但我希望它继续 'Yes',即使用户输入 'OK'、'Ya'、'Yeah' 等。我如何添加确认选项
您需要将新条款添加到 FormBuilder 配置的 Yes
数组中。类似于:
public static IFormBuilder<T> CreateCustomForm<T>()
where T : class
{
var form = new FormBuilder<T>();
var yesTerms = form.Configuration.Yes.ToList();
yesTerms.Add("Ya");
form.Configuration.Yes = yesTerms.ToArray();
return form;
}
那你就可以像这样使用了:
return CreateCustomForm<MyForm>()
原因如下:
Confirmation field, set it's type to bool. At some point, a recognizer is defined for the field, based on it's type. In this, case, the Confirmation
field will use the RecognizeBool 识别器。
识别器使用 Yes/No arrays defined in the form's configuration (which initially they are retrieved from the resource file) for doing the parsing.
将Confirmation
字段添加到Form后,a ConfirmStep step is also added. The ConfirmStep is the one that later in the game ends up calling the recognizer进行词条匹配解析