Skip to content

Commit 64370bf

Browse files
committed
Added a new IntentDialog.recognizer() method to create a cleaner way of adding recognizers to an intent dialog.
1 parent 1eaa6fa commit 64370bf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Node/core/src/botbuilder.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,12 @@ export class IntentDialog extends Dialog {
19641964
* @param dialogArgs (Optional) arguments to pass the dialog that started when `dialogId` is a _{string}_.
19651965
*/
19661966
onDefault(dialogId: string|IDialogWaterfallStep[]|IDialogWaterfallStep, dialogArgs?: any): IntentDialog;
1967+
1968+
/**
1969+
* Adds a new recognizer plugin to the intent dialog.
1970+
* @param plugin The recognizer to add.
1971+
*/
1972+
recognizer(plugin: IIntentRecognizer): IntentDialog;
19671973
}
19681974

19691975
/**

Node/core/src/dialogs/IntentDialog.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ export class IntentDialog extends dlg.Dialog {
238238
return this;
239239
}
240240

241+
public recognizer(plugin: IIntentRecognizer): this {
242+
// Append recognizer
243+
this.options.recognizers.push(plugin);
244+
return this;
245+
}
246+
241247
private recognizeInParallel(context: dlg.IRecognizeContext, done: (err: Error, result: IIntentRecognizerResult) => void): void {
242248
var result: IIntentRecognizerResult = { score: 0.0, intent: null };
243249
async.eachLimit(this.options.recognizers, this.options.processLimit, (recognizer, cb) => {

0 commit comments

Comments
 (0)