Hello all together, i try to set up an food advise bot with rasa, for my frontent i use react-chat-widget. But i have the following problem: i want to save the button payload into a slot. My first custom action is also working and send the buttons to FE, after pressing the button the slot get filled with the correct data. It also recognize my intent “choose” correctly and try to keep on with my second action. But here always a failure occurs.
These are my two custom actions:
# function for asking user for being vegan, vegetarian - send buttons to the FE
class ActionAskForVegetarian(Action):
def name(self) -> Text:
return "ask_for_veg"
def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict
) -> List[EventType]:
dispatcher.utter_message(
text="Bist du Vegetarier, Vegan oder Allesesser?:",
buttons=[{"payload": "/choose{\"veg_ent\": \"eat_all\"}", "title": "Allesesser"},
{"payload": "/choose{\"veg_ent\": \"vegan\"}", "title": "Vegan"},
{"payload": "/choose{\"veg_ent\": \"vegetarian\"}", "title": "Vegetarier"}]
)
return []
# function which saves decision from above function to a slot and reply to the user
class ActionSetSlotAndReplyVegetarian(Action):
def name(self) -> Text:
return "reply_to_veg"
def run(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict
) -> List[EventType]:
reply = tracker.get_slot('veg_slot')
# reply to the user that veg decision is saved in a slot - bot will remember
dispatcher.utter_message(
text=f"Gut ich merke mir, dass du {reply} bist!"
)
return []
my domain file:
intents:
- greet
- goodbye
- affirm
- deny
- mood_great
- mood_unhappy
- bot_challenge
- advice
- no_advice
- decide_for_direction
- ital
- amerik
- choose_food
- next_food
- finish_choosing_category
- choose
entities:
- veg_ent
slots:
veg_slot:
type: text
influence_conversation: false
mappings:
- type: from_entity
entity: veg_ent
actions:
- ask_for_veg
- reply_to_veg
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: false
In my NLU file i have the intent “choose” and story looks like this:
stories:
- story: happy advice path
steps:
- intent: greet
- action: utter_support_question
- intent: advice
- action: ask_for_veg
- intent: choose
- action: reply_to_veg
until this point everything is fine, but last action doesn’t want to work
Does anybody know where the failure is and if i need forms for filling buttons via custom actions? Thanks in advance