In this tutorial, we will go over undo and branching operations.
Allows the developer to “undo” the last user input or action choice. Behind the scenes, “undo” actually creates a new dialog and replays it up to the previous step. This means that the entity detection callback and API calls in the dialog will be called again.
Creates a new train dialog, which begins in the same way as an existing train dialog – this saves the effort of manually re-entering dialog turns. Behind the scenes, “branch” creates a new dialog and replays the existing train dialog up to the selected step. This means that the entity detection callback and API calls in the dialog will be called again.
This tutorial requires that the Bot that takes pizza orders is running:
npm run demo-pizza
If you've already worked through the pizza ordering tutorial, then simply open that Model from the list in the web UI. Otherwise you will need to click on "Import Tutorials" and select the model named "Demo-PizzaOrder".
Here is an example of how to see the Undo
feature in action:
- On the left panel, click "Train Dialogs", then click the
New Train Dialog
button. - Type "Order a pizza".
- Click the
Score Actions
button. - Click to Select "What would you like on your pizza?"
- Type "anything".
- Click the
Undo
button.- The last entry is removed, leaving the last Bot response of "What would you like on your pizza?"
For this demo, we'll open an existing Train Dialog and create a new Train Dialog from it by branching.
- On the left panel, click "Train Dialogs".
- Notice the grid, you should see only one training that starts with "new order".
- In the grid, click "new order" to open the existing Train Dialog.
- Click on the last "no" in the dialog.
- Click the "Branch" icon, it is circled in red in this image:
- Type "yes", hit enter.
- Click the
Score Actions
button.- At this point the Bot automatically picks a response, but we don't like the response so we are going to change it.
- Click on the last Bot response.
- This will let us select a different response.
- Select "UseLastToppings".
- Click the
Score Actions
button.- Again the Bot automatically picks a response. It should say, "You have sausage, cheese and mushrooms on your pizza.".
- This time we like the response so we will keep it.
- Click the
Score Actions
button.- Again the Bot automatically picks a response, It should say, "Would you like anything else?"
- Type "no".
- Click the
Save Branch
button. - Notice that the grid now has two trainings that starts with "new order".
- One of them is the one you used to branch off of.
- And the other one is the branched version that you just saved.
- Click on each of them to verify these expectations.
[!div class="nextstepaction"] Versioning and tagging