Hi, I have a bot which is supposed to reply differently based on which button that user clicks. But I am not sure why sometimes it happens that the bot didn’t give respective response based on the slot values linked to each button and I have to implement in custom action by checking slot value first and then triggering corresponding reply by FollowupAction. The only reason that I can think of for now is I wrote training stories for those options of different amount, which might result in unbalancing issue. Could someone help?
class ActionReplyAccessibilitySelection(Action):
def name(self) -> Text:
return "action_reply_accessibility_selection"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
if tracker.get_slot("accessibility_option") == "readability":
return [FollowupAction("action_readability")]
elif tracker.get_slot("accessibility_option") == "simple_language":
return [FollowupAction("utter_simple_language_reply")]
elif tracker.get_slot("accessibility_option") == "sign_language":
return [FollowupAction("action_trigger_sign_language_screen")]
elif tracker.get_slot("accessibility_option") == "volume_adjustment":
return [FollowupAction("action_trigger_volume_screen")]
utter_accessibility_options:
- buttons:
- payload: /select_accessibility_option{{"accessibility_option":"readability"}}
title: 1. Lesbarkeit
- payload: /select_accessibility_option{{"accessibility_option":"volume_adjustment"}}
title: 2. Lautstärke
- payload: /select_accessibility_option{{"accessibility_option":"sign_language"}}
title: 3. Gesten- und Gebärdensprache
- payload: /select_accessibility_option{{"accessibility_option":"simple_language"}}
title: 4. Einfache Sprache
text: Hierfür gibt es verschiedene Wahlmöglichkeiten
entities:
- accessibility_option
slots:
accessibility_option:
type: categorical
influence_conversation: true
values:
- readability
- sign_language
- simple_language
- volume_adjustment
- story: select readability
steps:
- action: utter_accessibility_needs
- intent: affirm
- action: utter_accessibility_options
- intent: select_accessibility_option
entities:
- accessibility_option: readability
- action: action_reply_accessibility_selection
- action: action_readability
- intent: continue_dialog
- action: utter_readability_reply
- action: action_accessibility_is_done
- slot_was_set:
- accessibility_is_done: true
- action: utter_ask_customer_account