node.js - how to stop bot to not move forward unless entity is resolves -
var intent = args.intent; var number = builder.entityrecognizer.findentity(intent.entities, 'builtin.numer');
when use findentity move forward if answer correct or not how can use entity resolve on not builtin entites
var location1 = builder.entityrecognizer.findentity(intent.entities, 'location'); var time = builder.entityrecognizer.resolvetime(intent.entities);
when use resolve time ask againand again unless entity resolve;
var alarm = session.dialogdata.alarm = { number: number ? number.entity : null, timestamp: time ? time.gettime() : null, location1: location1? location1.entity :null }; /* if (!number & !location1 time) {} */ // prompt number if (!alarm.number) { builder.prompts.text(session, 'how many people are'); } else { next(); } }, function (session, results, next) { var alarm = session.dialogdata.alarm; if (results.response) { alarm.number = results.response; }
i believe i've answered question on stackoverflow: "botframework prompt dialogs until user finishes".
you'll need create mini-dialog, have @ least 2 waterfall steps. first step take args
, check/set them potential value chatbot waiting for. it'll prompt user verify these correct values. if no args
passed in, or data not valid, user prompted supply value chatbot waiting for.
the second step take user's response first step , either set value session
data object (like session.userdata
or session.conversationdata
) or restart dialog using session.replacedialog() or session.begindialog().
in main dialog you'll modify step employ entityrecognizers
include if-statement begins mini-dialog. trigger if-statement, use same design shown in github example or in code. code might below:
var location1 = builder.entityrecognizer.findentity(intent.entities, 'location'); session.userdata.location1 = location1 ? location1.entity : null; if(!session.userdata.location1) { session.begindialog('<get-location-dialog>'); }
Comments
Post a Comment