File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -127,12 +127,10 @@ export class Library extends EventEmitter {
127
127
// top intent is passed along as part of routing. The root libraries recognize()
128
128
// method will be called a second time so we want to avoid the second recognize
129
129
// pass.
130
- var skipRecognize = ( context . intent && context . libraryName === this . name ) ;
131
- if ( this . recognizers . length > 0 && ! skipRecognize ) {
130
+ if ( this . recognizers . length > 0 && context . libraryName !== this . name ) {
132
131
this . recognizers . recognize ( context , callback ) ;
133
132
} else {
134
- // Pass through the top intent recognized by the root libraries recognizers.
135
- callback ( null , context . intent ) ;
133
+ callback ( null , context . intent || { intent : 'None' , score : 0.0 } ) ;
136
134
}
137
135
}
138
136
Original file line number Diff line number Diff line change @@ -464,12 +464,12 @@ export class UniversalBot extends Library {
464
464
// Run the root libraries recognizers
465
465
var context = session . toRecognizeContext ( ) ;
466
466
this . recognize ( context , ( err , topIntent ) => {
467
- if ( topIntent && topIntent . score > 0 ) {
468
- // This intent will be automatically inherited by child libraries
469
- // that don't implement their own recognizers.
470
- context . intent = topIntent ;
471
- context . libraryName = this . name ;
472
- }
467
+ // This intent will be automatically inherited by child libraries
468
+ // that don't implement their own recognizers.
469
+ // - We're passing along the library name to avoid running our own
470
+ // recognizer twice.
471
+ context . intent = topIntent ;
472
+ context . libraryName = this . name ;
473
473
474
474
// Federate across all libraries to find the best route to trigger.
475
475
var results = Library . addRouteResult ( { score : 0.0 , libraryName : this . name } ) ;
You can’t perform that action at this time.
0 commit comments