IBM-Cloud / cloudco-insurance

A modern insurance company. The application showcases cognitive and cloud computing ideas in the context of insurance.
Other
45 stars 38 forks source link

insurance-bot crashes if the user message is too detailed and the bot was not able to infer the chosen procedure yet #2

Closed l2fprod closed 7 years ago

l2fprod commented 7 years ago

Log in the website:

No reply from Ana.

The insurance-bot app crashes at the same time:

Got response from Ana: {"intents":[{"intent":"get_info","confidence":0.9484212745612777}],"entities":[{"entity":"details","location":[18,26],"value":"coverage"},{"entity":"types","location":[31,35],"value":"vision"}],"input":{"text":"I need to know my coverage for eyes"},"output":{"log_messages":[],"text":["I can get your coverage for you. What service do you need info for? I've got information on your vision, dental, mental, and physical plans."],"nodes_visited":["node_12_1476151077484"]},"context":{"fname":"Frederic","lname":"Lavigne","services":["vision","dental","mental","physical"],"procedures":[["eye wear","eye exams"],["teeth cleaning","orthodontics","tooth repair"],["Psychologist"],["Chiropractor","Physiotherapy"]],"conversation_id":"0c7a49f3-9fac-4acd-ac55-bb7ff3706621","system":{"dialog_stack":["node_12_1476151077484"],"dialog_turn_counter":3,"dialog_request_counter":3},"chosen_detail":"coverage"}} /Users/fred/dev/cloudco/insurance-bot/bot.js:324 text = "Your " + detail + " for " + procedure + " is " + procedure_details[detail]; ^

TypeError: Cannot read property 'coverage' of undefined at updateContextObject (/Users/fred/dev/cloudco/insurance-bot/bot.js:324:83) at /Users/fred/dev/cloudco/insurance-bot/bot.js:85:21 at Request._callback (/Users/fred/dev/cloudco/insurance-bot/node_modules/watson-developer-cloud/lib/requestwrapper.js:75:5) at Request.self.callback (/Users/fred/dev/cloudco/insurance-bot/node_modules/watson-developer-cloud/node_modules/request/request.js:187:22) at emitTwo (events.js:100:13) at Request.emit (events.js:185:7) at Request. (/Users/fred/dev/cloudco/insurance-bot/node_modules/watson-developer-cloud/node_modules/request/request.js:1044:10) at emitOne (events.js:90:13) at Request.emit (events.js:182:7) at IncomingMessage. (/Users/fred/dev/cloudco/insurance-bot/node_modules/watson-developer-cloud/node_modules/request/request.js:965:12) at emitNone (events.js:85:20) at IncomingMessage.emit (events.js:179:7) at endReadableNT (_stream_readable.js:913:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) [nodemon] app crashed - waiting for file changes before starting...

l2fprod commented 7 years ago

Issue seems to come from my sentence where I talk about the "detail" (coverage) without having previously talked about the "procedure" (eye).

If I rephrase and say:

1/ Hi 2/ I have a questions about my eyes 3/ new glasses 4/ what is my coverage

then Ana infers service, procedure and detail correctly.

sharpstef commented 7 years ago

Ran through test case. Doesn't crash now.