Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UI Schema - Recognizer #4135

Merged
merged 59 commits into from
Sep 23, 2020
Merged

Conversation

yeze322
Copy link
Contributor

@yeze322 yeze322 commented Sep 15, 2020

Description

Use uischema to control which Recognizers can be used in Composer. Including

  • Enable a new Recognizer in dropdown - by editing the uischema 'recognizer' part
  • Edit the label name of a Recognizer in dropdown - by setting displayName
  • Set a Recognizer as default Recognizer when creating dialog - by setting default: true
  • Hide a Recognizer from dropdown - by setting disabled: true

Remainings

  • When seeding a new Dialog, use the default recognizer described by uischema
  • Integartion with publish flow (Will be covered in another PR)
  • Code cleanup (//leak, //TODO)
  • Fix the UT (broken by schema change)

Usage
(To make it simple, use sdk.override.uischema as an example.)

  1. Open the sdk.override.uischema file under a bot project (DO use override schema due to plugin has higher priority than sdk.uischema. Will be moved to botbuilder component schema)
  2. Paste these Recognizer options.
{
  "$schema": "https://schemas.botframework.com/schemas/ui/v1.0/ui.schema",
  "Microsoft.PVARecognizer": {
    "recognizer": {
      "displayName": "Default Recognizer (PVA)",
      "default": true
    }
  },
  "Microsoft.CrossTrainedRecognizerSet": {
    "recognizer": {
      "displayName": "Luis QnA Recognizer",
      "default": false
    }
  }
}

PVARecognizer will be added to dropdown menu.

Task Item

closes #4111

Screenshots

@cwhitten
Copy link
Member

cwhitten commented Sep 15, 2020

@yeze322 we want to allow PVA or another runtime to model the Default Recognizer to be their recognizer instead of our Luis + QnA cross-trained components. So the scenario is:

I can provide a schema + uischema that allows me to override the behavior & configuration of the default recognizer with my own behavior & configuration

In PVA's case they will essentially alias the Default Recognizer to be their PVARecognizer component because there are no additional build steps.

@yeze322
Copy link
Contributor Author

yeze322 commented Sep 16, 2020

@cwhitten Yes we can, I added a new field default: boolean to recognizer uischema.

Take the PVA scenario as an example, we want PVARecognizer become the default recognizer. We override the uischema with this JSON:

{
  "Microsoft.CrossTrainRecognizerSet": {
    "recognizer": {
      "displayName": "LUIS Recognizer",
      "default": false
    }
  },
  "Microsoft.PVA.Recognizer": {
    "recognizer": {
      "displayName": "Default Recognizer (PVA)",
      "default": true
    }
  }
}

@yeze322
Copy link
Contributor Author

yeze322 commented Sep 21, 2020

@liweitian There are several questions about issues left over from QnA PR in Andy's code review, could you answer them?

@a-b-r-o-w-n a-b-r-o-w-n merged commit 66ac5d0 into microsoft:main Sep 23, 2020
alanlong9278 added a commit to alanlong9278/BotFramework-Composer that referenced this pull request Sep 28, 2020
* main:
  fix: update l10n file (microsoft#4247)
  fix: fix loading of extensions by removing sample-ui-plugin (microsoft#4251)
  fix: split qna resource to another template (microsoft#4212)
  feat: UI Schema - Recognizer (microsoft#4135)
  fix: Change http to https for petstore.swagger.io calls (microsoft#4238)
  feat: install remote extensions from npm (microsoft#4224)
  fix: refactored select skill ui-plugin (microsoft#4207)
  feat: Added fieldSets to UIOptions (microsoft#4231)
  fix: New LG template not sync to other locale files (microsoft#4230)
@cwhitten cwhitten mentioned this pull request Nov 13, 2020
benbrown pushed a commit to benbrown/BotFramework-Composer that referenced this pull request May 24, 2021
* main:
  fix: update l10n file (microsoft#4247)
  fix: fix loading of extensions by removing sample-ui-plugin (microsoft#4251)
  fix: split qna resource to another template (microsoft#4212)
  feat: UI Schema - Recognizer (microsoft#4135)
  fix: Change http to https for petstore.swagger.io calls (microsoft#4238)
  feat: install remote extensions from npm (microsoft#4224)
  fix: refactored select skill ui-plugin (microsoft#4207)
  feat: Added fieldSets to UIOptions (microsoft#4231)
  fix: New LG template not sync to other locale files (microsoft#4230)
benbrown pushed a commit that referenced this pull request Jun 11, 2021
* main:
  fix: update l10n file (#4247)
  fix: fix loading of extensions by removing sample-ui-plugin (#4251)
  fix: split qna resource to another template (#4212)
  feat: UI Schema - Recognizer (#4135)
  fix: Change http to https for petstore.swagger.io calls (#4238)
  feat: install remote extensions from npm (#4224)
  fix: refactored select skill ui-plugin (#4207)
  feat: Added fieldSets to UIOptions (#4231)
  fix: New LG template not sync to other locale files (#4230)
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* chore: turn RecognizerField to folder

* extract 'useMigrationEffect'

* remove dup & no ref file 'defaultRecognizers'

* move out complicated selectedType func && var names

* use 'dropdownOption' to replace 'isCustomType' which is anti-pattern

* add 'default' and 'disabled' to RecognizerSchema

* set CrossTrain to default, disable Luis

* impl 'getRecognizerDefinition()'

* move DefaultRecognizers to separated file

* rename: 'editor' -> 'intentEditor'

* impl 'recognizerEditor' in Recognizer schema

* adapt to schema's 'disabled' property

* sort recognizer options

* make renameIntent optional

* make handleRecognizerChange optional & impl fallback submit func

* impl mappers to map among 'schema', 'dropdown', 'value'

* provide 'findRecognizer' as hook's buitin func

* apply findRecognizer to RecognizerField

* mark isSelected optional

* add a todo

* merge 'recognizers' to uiSchema

* migrate to new RecognizerUISchema

* don't show non-recognizer $kinds as dropdown

* adjust dropdown order

* make the 'Custom Rec' with JSON editor as fallback option

* fix tslint error

* omi RegexRecognizer's `isSelected` option

* resolve intentEditor logic leaks

* fix UT

* fix UT

* impl getDefaultRecognizer()

* create default recognizer when seeding new dialog

* fix UT

* copyright

* del 'default' opt from crosstrain plugin

Due to uischema merge priority, plugin settings are hard to be
overrided. CrossTrain is already set to default in
'useRecongizerConfig.ts/getDefaultRecognizer'

* migrate handleRecognizerChange to seedNewRecognizer

* mark a todo

* update `seedNewRecongnizer` interface & apply to dialog modal

* Fix wording issue in comments

Co-authored-by: Andy Brown <asbrown002@gmail.com>

* minor fixes on code style & comments

* type the 'disabled' field strictly

* more strict `isSelected()` method in CrossTrainReocognizer shema

* update default recognizer value

* provide 'current' and 'default' recognizer schema in useRecognizerConfig()

* fix UTs

* remove custom recognizer template

* write `displayName` as function to support multi-locale

Co-authored-by: Ben Yackley <61990921+beyackle@users.noreply.github.com>
Co-authored-by: Andy Brown <asbrown002@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support UI Schema for Recognizer
6 participants