How to determine the default behavior for a bot in Node.js?

Consider the following dialog box.

bot.dialog('/beer', [
    function (session) {
        builder.Prompts.number(session, "How many mugs would you like?");
    },
    function (session, results) {
        if (results.response && results.response.entity != '(quit)') {
            // Launch demo dialog
            session.endDialog("Beer" + (results.response == 1 ? " is on the" : "s are on their") + " way, enjoy!");
        } else {
            // Exit the menu
            session.endDialog("Goodbye, See you later..");
        }
    }
]);

When this is requested by the user, if the user enters text (for example, "Test") instead of a valid number, the bot gives an answer like default_number .

The same default error message for default_number , selection default_choice , text default_error , etc. I tried different ways to figure out how to take control of it and determine the default behavior, something like a bot, says "I did not recognize it, try again" instead of giving an error, which makes no sense to the user.

Can anyone highlight this?

https://docs.botframework.com/en-us/node/builder/chat/prompts/#promptsnumber

+4
1

( .)

, .

-

" , - , ".

" "..

Direct Line API/ , , Skype. , " default_error", " default_choice" ..

, "BotBuilder.json"

BotProject/locale/<languageCode>/BotBuilder.json

, , :

{
    "default_error": "I did not recognize it. Please try again."
}

</" > . , .

{
    "default_text": "I didn't understand. Please try again.",
    "default_number": "I didn't recognize that as a number. Please enter a number.",
    "default_confirm": "I didn't understand. Please answer 'yes' or 'no'.",
    "default_choice": "I didn't understand. Please choose an option from the list.",
    "default_time": "I didn't recognize the time you entered. Please try again using a format of (MM/DD/YYYY HH:MM:SS).",
    "default_file": "I didn't receive a file. Please try again.",
    "default_error": "Oops. Something went wrong and we need to start over."
}   
+3

Source: https://habr.com/ru/post/1659918/


All Articles