Hi @mac_71128,
I am currently using this to deactivate a form:
def validate(self, dispatcher, tracker, domain):
# type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
"""Extract and validate value of requested slot.
If nothing was extracted reject execution of the form action.
Subclass this method to add custom validation and rejection logic
"""
slot_to_fill = tracker.get_slot(REQUESTED_SLOT)
reset = self._check_reset_form_action_on_intent(tracker=tracker, dispatcher=dispatcher)
if reset:
return self.deactivate()
Where self._check_reset_form_action_on_intent(tracker=tracker, dispatcher=dispatcher)
is implemented like this:
def _check_reset_form_action_on_intent(self, tracker: Tracker, dispatcher):
"""
:param tracker:
:param dispatcher:
:return:
"""
last_intent = tracker.latest_message['intent'].get('name')
if last_intent == 'reset_dialogue':
dispatcher.utter_message('Okay, gern. Was kann ich sonst für Sie tun?')
return True
else:
return False
Of course there won’t be any need of using such a method - you can return the deactivate statement right out of validate, if that suits your case.
Did that help you?
Regards