Closed
Description
The changes in Change ChoiceSet to support LG (#5309) may need to be ported to maintain parity with microsoft/botbuilder-dotnet
.
Fixes #Description
Change ChoiceSet to be able to be defined with LG.
You can define ChoiceSet as
STRING ==> opt1 | opt2 | opt3 STRING[] ==> [ "opt1", "opt2", "opt3" ] CHOICE[] ==> [ { ...opt1..}, {...opt2}, {...opt3...}]
So with LG you can simply do the same:
# MyChoices_simple - dog | cat
Or define objects in LG like this
# MyChoices_complex - ''' [ { "value": "dog", "synonyms": ["doggy","wolf"] }, { "value": "cat", "synonyms": ["pussycat","kitty"] } ] '''
So a full example:
# MyChoices_Prompt - Please select # MyChoices_UnknownPrompt - Not a dog or cat. Please select # MyChoices_simple - dog | cat
ChoiceInput in a dialog
{ "$kind": "Microsoft.ChoiceInput", "choices": "${MyChoices_simple()}", "prompt": "${MyChoices_Prompt()}", "unrecognizedPrompt": "${MyChoices_UnknownPrompt()}" },Specific Changes
- Implemented ITemplate.BindData method
- Changed ChoiceInput and ConfirmInput to use ITemplate.BindData()
- Fixed Try method to not throw when Expression.Parse() fails.
Testing
- Added unit tests for simple/complex binding for both ConfirmInput and ChoiceInput with multi-lingual fall back working.
Please review and, if necessary, port the changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment