在使用Adaptive Card创建任务流(Task flow)时,可以使用动态类型搜索来自动完成用户输入。例如,当用户开始输入时,卡片会显示一个下拉列表,显示与输入匹配的选项。以下是在Adaptive Card中使用动态类型搜索的示例代码:
{ "type": "Input.ChoiceSet", "id": "fruitChoice", "style": "compact", "placeholder": "Choose a fruit", "choices": [ { "title": "Apple", "value": "apple" }, { "title": "Banana", "value": "banana" }, { "title": "Cherry", "value": "cherry" }, { "title": "Grapefruit", "value": "grapefruit" }, { "title": "Kiwi", "value": "kiwi" }, { "title": "Lemon", "value": "lemon" }, { "title": "Mango", "value": "mango" }, { "title": "Orange", "value": "orange" }, { "title": "Pineapple", "value": "pineapple" }, { "title": "Strawberry", "value": "strawberry" } ], "isMultiSelect": false, "choicesMax": 3, "dynamicChoices": { "allowFreeform": "true", "minChars": 1, "maxSuggestions": 5, "queryURL": "https://myfruitsuggestionapi.com/search?q=${query}", "headers": [ { "name": "Authorization", "value": "Bearer my_token" } ], "additionalParams": {} } }
在上面的示例中,我们使用了Input.ChoiceSet输入类型,并使用了dynamicChoices属性来实现动态类型搜索。dynamicChoices包含一些参数,通过它们可以控制搜索的行为,例如:
allowFreeform:是否允