Skip to content

Conversation

@menachem-stratfs
Copy link

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);
        ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant