This tutorial shows how to add and use a simple card in your bot.
Note
Conversation Learner currently expects your card definition files to be located in a directory called "cards" which is present in the directory where the Bot is started.
This tutorial requires that the general tutorial bot is running
npm run tutorial-general
Cards are UI elements that allow the user to select an option in the conversation.
In the web UI, click on "Import Tutorials" and select the model named "Tutorial-15-Cards".
The card definition is at the following location: C:<installedpath>\src\cards\prompt.json.
The system expects to find your card definitions in this "cards" directory.
Note
Notice the body type "TextBlock" and the "{{question}}" placeholder in the text field. There are two submit buttons and the text that gets submitted for each.
We have created three Actions. As you see below, the first Action is a card.
Let's see how the card Action type was created:
Note
The card contains three different parameters - question input, button 1 and button 2. These elements are template references in the card where you enter the question and the respective answers. You can also reference and use Entities or a mixture of text and Entities.
The eye icon shows you what the card looks like.
- On the left panel, click "Actions", then the "New Action" button.
- Select "CARD" for the "Action Type."
- Select "prompt" from the "Template" list.
- In the "question" field, type "Go left or right"
- In the "button1" field, type "left"
- In the "button2" field, type "right"
- Click the "Cancel" button.
- On the left panel, click "Train Dialogs", then the "New Train Dialog" button.
- In the chat panel, where it says "Type your message...", type in "hi"
- Click the "Score Actions" button.
- Select the response, "prompt: question: Go left or right?"
- The eye icon can be used to preview the card
- In the chat panel click the "Left" button in the rendered prompt.
- Click the "Score Actions" button.
- Select the response, "Left"
- Click the "Save" button.
- Select the response, "prompt: question: Go left or right?"
- In the chat panel click the "Right" button in the rendered prompt.
- Click the "Score Actions" button.
- Select the response, "Right"
[!div class="nextstepaction"] Hybrid Bots