How can I quit from a Active Form

Can you help me in this…

Try to make stories and in this use action_deactivate_form and then form : null.

because self._deactivate() method not work properly in my project.

chitchat

  • request_restaurant
    • restaurant_form
    • form{“name”: “restaurant_form”}
  • stop
    • utter_ask_continue
  • deny
    • action_deactivate_form
    • form{“name”: null}

like this and for more details you can read documentation.

action_deactivate_form is default action. No need write any custom actions in action file and no need to mention in domain file?

Yes you can also make story from Rasa X for simplicity.

quit

This is how I getting and make story for this using default deactivate action

  • greet
    • utter_service
  • bookingservice
    • booking_form
    • form{“name”:“booking_form”}
  • stop
    • action_deactivate_form
    • form{“name”: null}

To achieve this behavior in Rasa 2.0, I believe you would need to modify the required_slots method of the form validation action to look something like this:

async def required_slots(
        self,
        slots_mapped_in_domain: List[Text],
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict",
) -> Optional[List[Text]]:

    if tracker.get_intent_of_latest_message() == "some_intent":
    	return []

	return slots_mapped_in_domain

Unless there is a more natural solution that I’m missing…

1 Like

returning either self.deactivate() or [FollowupAction()] works fine, but what about cases where you need to do BOTH?

Ie.the user choses to cancel the active form, and you also want to return a specific action in response to them canceling the form?

Have looked everywhere in documentation and code to figure out how this is accomplished, what’s the secret?

I wouldn’t suggest to use FollowupAction, rather create a rule to predict next action after the form is completed

Thank you so much!!! :kissing_closed_eyes: