Skip to content

Commit

Permalink
chore: cherrypick changes for 4.14.1 (#3871)
Browse files Browse the repository at this point in the history
* port: beginskill uischema fix (#3854)

Fixes #3853

* make getTopScoringIntent return '' instead of undefined (#3870)

Co-authored-by: taicchoumsft <61705609+taicchoumsft@users.noreply.github.com>
  • Loading branch information
Josh Gummersall and taicchoumsft committed Jul 15, 2021
1 parent c4d0d5b commit 8590995
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libraries/botbuilder-core/src/recognizerResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const getTopScoringIntent = (result: RecognizerResult): { intent: string;
throw new Error('result is empty');
}

let topIntent: string;
let topIntent: string = '';
let topScore = -1;
for (const [intentName, intent] of Object.entries(result.intents)) {
const score = intent.score ?? -1;
Expand Down
16 changes: 16 additions & 0 deletions libraries/botbuilder-core/tests/getTopScoringIntent.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const assert = require('assert');
const { getTopScoringIntent} = require('../lib');

describe('getTopScoringIntent', function () {
it(' should never return undefined', function () {
let result = getTopScoringIntent({
text: '',
intents: {},
entities: {}
});

assert.notStrictEqual(result.intent, undefined);
assert.strictEqual(result.intent, '');
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@
},
"flow": {
"widget": "ActionCard",
"colors": {
"theme": "#004578",
"color": "#FFFFFF",
"icon": "#FFFFFF"
},
"icon": "Library",
"body": {
"widget": "ResourceOperation",
"operation": "Host",
"resource": "=coalesce(action.skillEndpoint, \"?\")",
"singleline": true
},
"header": {
"widget": "ActionHeader",
"colors": {
"theme": "#004578",
"color": "#FFFFFF",
"icon": "#FFFFFF"
},
"icon": "Library"
},
"footer": {
"widget": "PropertyDescription",
"property": "=action.resultProperty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class CrossTrainedRecognizerSet extends AdaptiveRecognizer implements Cro
* @returns {boolean} Boolean result of whether or not an intent begins with the `DeferToRecognizer_` prefix.
*/
private isRedirect(intent: string): boolean {
return intent.startsWith(deferPrefix);
return intent?.startsWith(deferPrefix) ?? false;
}

/**
Expand Down
15 changes: 9 additions & 6 deletions libraries/tests.uischema
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,21 @@
"singleline": true,
"widget": "ResourceOperation"
},
"colors": {
"color": "#FFFFFF",
"icon": "#FFFFFF",
"theme": "#004578"
},
"footer": {
"description": "= Result",
"property": "=action.resultProperty",
"widget": "PropertyDescription"
},
"header": {
"colors": {
"color": "#FFFFFF",
"icon": "#FFFFFF",
"theme": "#004578"
},
"icon": "Library",
"widget": "ActionHeader"
},
"hideFooter": "=!action.resultProperty",
"icon": "Library",
"widget": "ActionCard"
},
"form": {
Expand Down

0 comments on commit 8590995

Please sign in to comment.