How can I quit from a Active Form

there is no the best way. You can do validation, as you do now, then add condition in request_next_slot, smth along the line:

def request_next_slot(self,
                      dispatcher,  # type: CollectingDispatcher
                      tracker,  # type: Tracker
                      domain  # type: Dict[Text, Any]
                      ):
    # type: (...) -> Optional[List[Dict]]
    """Request the next slot and utter template if needed,
        else return None"""

    intent = tracker.latest_message.get("intent", {}).get("name")
    if intent == 'cancel':
        return self._deactivate()
    else:
        for slot in self.required_slots(tracker):
            if self._should_request_slot(tracker, slot):
                logger.debug("Request next slot '{}'".format(slot))
                dispatcher.utter_template("utter_ask_{}".format(slot),
                                          tracker,
                                          silent_fail=False,
                                          **tracker.slots)
                return [SlotSet(REQUESTED_SLOT, slot)]

        logger.debug("No slots left to request")
        return None
7 Likes