fix: Make getTopScoringIntent return '' instead of undefined #3870
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes Composer#8368. fixes #minor.
Description
There is a minor drift between the dotnet and nodeJs implementation of
getTopScoringIntent
.In the NodeJS implementation,
topIntent
is declared but not initialized. In the case of emptyintents
bag, can returnundefined
.NodeJS Implementation
In the dotnet implementation, the topIntent is initialized.
Dotnet Implementation
This later causes an issue in
crossTrainedRecognizerSet
line 110, where anundefined
intent can be set.The
isRedirect
function will eventually be called on the undefined intent and cause the 500 error in the bot.Note: this entire chain of events is started at the end of a text input, when the recognizers are fired with an empty utterance (not sure why). Orchestrator recognizer will return a
RecognizerResult
with this shape in the case of empty utterance:Both LUIS and QnA fill the intents bag.
The dotnet Orchestrator implementation also returns an empty
intents
dictionary in the case of an empty utterance so we follow that behavior.Testing
UT added, manual testing to test for correct behavior.