Skip to content

Commit 36fee5a

Browse files
committed
Added fix for missing entities
1 parent b155447 commit 36fee5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

labs/07-nlp-with-luis/bot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ class LuisBot {
4343

4444
// check if the entity found is the one we are looking for
4545
// this is usually only necessary if there are more then one entity in an intent
46-
if(entities[0].type == "Product") {
46+
if(entities.length > 0 && entities[0].type == "Product") {
4747
// we found a product
4848
var product = entities[0].entity;
4949
await turnContext.sendActivity(`Your ordered ${ product }`);
5050
} else {
5151
// we found nothing
52-
await turnContext.sendActivity(`Your ordered nothing`);
52+
await turnContext.sendActivity(`I do not know what you ordered.`);
5353
}
5454
}
5555
} else {

0 commit comments

Comments
 (0)