With the release of Botkit 4.8, bot developers now have access to the full message object inside of dialogs. This allows for the opportunity to use LUIS entities not just to trigger new dialogs, but also as a means of interpreting a user's response to a prompt.
For example:
dialog.addQuestion('Enter a date', async (rawInput, convo, bot, message) => {
const dateEntity = message.entities.find(entity => entity.type === 'builtin.datetimeV2.date');
const date = new Date(dateEntity.resolution.value);
doStuffWith(date);
...
}
The PR exposes an option alwaysIncludeEntities that, when true, will attach entities from the LUIS service to the message.
I've also added a helper function that finds an expected entity type. It can be used like this:
dialog.addQuestion('Please enter the price', async (rawValue, convo, bot, message) => {
const number = luis.middleware.getEntity(message, 'builtin.number', 'builtin.currency') || rawValue;
doStuffWith(number);
...
}
With the release of Botkit 4.8, bot developers now have access to the full
message
object inside of dialogs. This allows for the opportunity to use LUIS entities not just to trigger new dialogs, but also as a means of interpreting a user's response to a prompt.For example:
The PR exposes an option
alwaysIncludeEntities
that, when true, will attach entities from the LUIS service to the message.I've also added a helper function that finds an expected entity type. It can be used like this: