Deactive Form and Reset All Slots

Hi, Is there any way to deactivate a Form and reset all slots filled by the form if at any stage an intent other than Form related intents is detected?

My rules.yml file currently contains following piece of code for Form

- rule: Activate billcode form
  steps:
  - intent: billcode
  - action: billcode_form
  - active_loop: billcode_form

- rule: Submit Billcode form
  condition:
  - active_loop: billcode_form
  steps:
  - action: billcode_form
  - active_loop: null
  - slot_was_set:
    - requested_slot: null
  - action: action_billcode

You can set an ignored intent for each of the forms. This will mean that this intent does not fill a slot. If a requested slot couldn’t be filled in a form, then whatever rules you have defined will kick in. This is described here. There is also an example rule that should work for you with some modification to use the correct intents:

stories:
- story: User interrupts the form and doesn't want to continue
  steps:
  - intent: request_restaurant
  - action: restaurant_form
  - active_loop: restaurant_form
  - intent: stop
  - action: utter_ask_continue
  - intent: stop
  - action: action_deactivate_loop
  - active_loop: null

You can reset slots with the AllSlotsReset event described here

1 Like