What is the best approach to handle Fallback at any stage and trigger an action. Two-stage Fallback Policy seems like an over kill when all I want to do is trigger an utter and ask for using to fill a contact form.
I have seen a lot of examples but nothing with such scenario. Maybe I missed it. It would be great if someone can answer or point me to the right resource.
If this can help someone in near future. solution. Not perfect though.
class ActionUtterNext(Action):
def name(self) -> Text:
return "action_utter_next"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
emails = tracker.get_slot("email_id")
dispatcher.utter_message("Thank you ! You will soon receive an email from us at {}".format(emails))
return [AllSlotsReset(),UserUtteranceReverted()]
class ActionDefaultFallback(Action):
def name(self) -> Text:
return “action_default_fallback”
def run(self, dispatcher, tracker, domain):
logger = logging.getLogger(__name__)
emails = tracker.get_slot("email_id")
print(emails)
if emails is not None:
# dispatcher.utter_message(template="utter_additional_question_response")
return [FollowupAction("action_utter_next")]
else:
dispatcher.utter_message(template="utter_default")
return []