I need to force the “action_listen” in one step of my stories, but I couldn’t do it.
I tried to add it in the same story, and through custimized actions.
My story:
## StoryFallback - Generar Ticket - Ayudar en algo mas - No eso es todo - Bien
* GenerarTicket
- utter_fallback_ticket
- action_create_ticket
- action_listen
- action_create_ticket_before
- utter_act_menu_otros_epa
I don’t know if you can put action_listen in the middle like that. Normally action_listen is automatically executed at the end of each intent, so i think if you declare 5 actions like that it will always go through those 5 actions, which means it did execute action_listen in the middle, but didn’t wait for the user’s input and simply keep executing the follow up actions (although i’m not 100% sure about it, just my guess).
Secondly, if you need to receive user input in the middle of a process like that, why not split it into multiple intents, or use a FormAction ? Those approaches might be more suitable for the situation.
The general idea is that you declare a number of slots corresponding to the data which you want to ask the user to provide, i.e: name, age, product, etc,… This is called required_slots in FormAction.
After executing the FormAction, the bot will automatically ask for all the required slots sequentially with the utterances that you provide for each of them. You can also perform validating data in FormAction, if the user enters something invalid, you can make the bot ask the user again.
After the required slots are filled (which means the user provided all the necessary information), the FormAction will execute a submit function, which you will implement to do your logic with all the provided information from the user.
There are a lot of complex interaction which you can achieve by combining FormAction and Events together.
If i’m not mistaking, this error occurred because the bot failed to recognize the ticket entity in the message. It should ask the user for the ticket slot again.
How do you define the nlu data for the ticket entity ? Can you run ‘rasa shell nlu’ in the command line and test if the entity is recognized by the bot ?
The response of the command you sent me is as follows:
NLU model loaded. Type a message and press enter to parse it.
Next message:
/GenerarTicket
{
"text": "/GenerarTicket",
"intent": {
"name": "GenerarTicket",
"confidence": 1.0
},
"intent_ranking": [
{
"name": "GenerarTicket",
"confidence": 1.0
}
],
"entities": []
}
Next message:
From what I understand, the entity is recognizing well.
Secondly, the button’s payload is not an entity, it’s an intent. So when you push the button with payload “/GenerarTicket”, the bot understands that the user’s intent is “GenerarTicket” and response correspondingly. Therefore, the bot doesn’t receive any entity, hence the error.
You can set the slot with button by creating an intent like ‘inform_ticket’, then set the button’s payload as:
buttons:
- title: "Generar un Ticket"
payload: '/inform_ticket{"ticket": "GenerarTicket"}'