Hi RASA community!
When running RASA from my slot ‘dancing’ gets set correctly with ‘no’ if the user indicates no but afterwards it get filled with yes irrespective with which answers the slots are filled after that
Here are my slots:
question_dancing:
type: text
influence_conversation: false
mappings:
- type: from_intent
intent: affirm
value: yes
- type: from_intent
intent: deny
value: no
conditions:
- active_loop: basic_form
requested_slot: question_dancing
question_sport:
type: text
influence_conversation: false
mappings:
- type: from_intent
intent: affirm
value: yes
- type: from_intent
intent: deny
value: no
conditions:
- active_loop: basic_form
requested_slot: question_sport
question_reading:
type: text
influence_conversation: false
mappings:
- type: from_intent
intent: affirm
value: yes
- type: from_intent
intent: deny
value: no
conditions:
- active_loop: basic_form
requested_slot: question_reading
question_hiking:
type: text
influence_conversation: false
mappings:
- type: from_intent
intent: affirm
value: yes
- type: from_intent
intent: deny
value: no
conditions:
- active_loop: basic_form
requested_slot: question_hiking
When more than 2 are indicated with ‘yes’ I run a custom action to ask what the main hobby is:
class ActionMainHobby(Action):
def name(self) -> Text:
return "action_question_main_hobby"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
hobbies = ['question_dancing','question_sport','question_reading','question_hiking']
hobbies_values = [tracker.get_slot("question_dancing"), tracker.get_slot("question_sport"), tracker.get_slot("question_reading"), tracker.get_slot("question_hiking")]
dic = dict(zip(hobbies, hobbies_values))
button_titles = ['Dancing', 'Sport', 'Reading', 'Hiking']
buttons = []
counter = 0
for button_title, (key, value) in zip(button_titles, dic.items()):
if value == 'yes':
buttons.append({"payload":'/affirm', "title": button_title})
counter +=1
# print(buttons)
return_values = []
if counter > 1:
SlotSet("requested_slot", "question_main_hobby")
dispatcher.utter_message(text="Could you tell me which of those is your main hobby?",buttons=buttons)
elif counter == 1:
return_values.append(ActiveLoop(None))
elif counter < 1:
dispatcher.utter_message(text="No hobbies, okay...")
return
Does anyone see my mistake?