Use two from_intent mappings for different slots - Rasa Open Source - Rasa Community Forum
Use two from_intent mappings for different slots
post by n3rdc4ptn on Feb 1, 2022
Hello, this is my first topic.
My bot is getting information from the user via a form and I have two boolean slots where the user should answer yes or no to affirm and deny the question.
slots:
confirm_restaurant_interest:
type: bool
mappings:
- type: from_intent
intent: affirm
value: true
- type: from_intent
intent: deny
value: false
confirm_sights_interest:
type: bool
mappings:
- type: from_intent
intent: affirm
value: true
- type: from_intent
intent: deny
value: false
I also created two utterances for asking for the slots:
utter_ask_confirm_restaurant_interest:
- text: Möchtest Du in Restaurants essen gehen?
utter_ask_confirm_sights_interest:
- text: Möchtest Du Sehenswürdigkeiten sehen?
But when I start testing the bot I will only be asked for the first one “restaurant_interest” and after I answer the question the bot puts in true for both slots.
Is there a way to “reset” the from_intent mapping between these questions? So that the user will be asked for both slots separately?
I tried to find a solution online, but can't really find anything and also don't know how this behavior is called.
I fixed it myself using a condition.
confirm_restaurant_interest:
type: bool
mappings:
- type: from_intent
intent: affirm
value: true
conditions:
- active_loop: recommend_form
requested_slot: confirm_restaurant_interest
- type: from_intent
intent: deny
value: false
conditions:
- active_loop: recommend_form
requested_slot: confirm_restaurant_interest
confirm_sights_interest:
type: bool
mappings:
- type: from_intent
intent: affirm
value: true
conditions:
- active_loop: recommend_form
requested_slot: confirm_sights_interest
- type: from_intent
intent: deny
value: false
conditions:
- active_loop: recommend_form
requested_slot: confirm_sights_interest