我在 botframework 中创建了一个表单流。我想更改确认选项,默认情况下它采用"is"和“否”。但我希望它继续而不是"is",即使用户输入“确定”、"is"、"is"等。我如何添加确认选项
最佳答案
您需要将新条款添加到 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字段,设置为 type to bool .在某个时候,recognizer is defined for the field ,基于它的类型。在这种情况下,Confirmation
字段将使用 RecognizeBool识别器。
识别器使用 Yes/No在表单配置中定义的数组(最初它们是 are retrieved 来自 resource file )用于执行 the parsing .
当 Confirmation
字段添加到表单时,a ConfirmStep step is also added . ConfirmStep是游戏后期的那个ends up calling the recognizer进行术语的匹配和解析。
关于c# - 更改 botframework Formflow 中的确认选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42947804/