Hi there,
for everyone who stumbles upon this issue and needs to solve it, no matter if there is a more elegant way, here is a solution shown as a brief example on how the achieve the key objective:
Content of domain.yml
slots:
cancel_reason:
type: any
influence_conversation: false
privacy_agreement:
type: bool
influence_conversation: true
forms:
privacy_form:
privacy_agreement:
- intent: confirm
type: from_intent
value: true
- intent: deny
type: from_intent
value: false
cancel_reason_form:
cancel_reason:
- type: from_text
Content of rules.yml
- rule: Activate privacy_form
steps:
- intent: trigger_form_cycle
- action: privacy_form
- slot_was_set:
- privacy_agreement: null
- active_loop: privacy_form
Now I simply split my desired storyline into several forms. Actually I want to use forms because I can’t set slots inside stories and I want to make use of the intent-based auto-filling option that forms provide - meaning a more fine-grained control.
- rule: Deactivate privacy_form and end with utterance
condition:
- active_loop: privacy_form
steps:
- action: privacy_form
- slot_was_set:
- requested_slot: null
- active_loop: null
- slot_was_set:
- privacy_agreement: false
- action: utter_no_privacy_agreement
Actually I wrote a rule that checks the slot and it’s value (not just if the slot has been set) after the form has ended. If the value was set to false I simply utter something (or maybe you want to do a custom action as a follow up) and if the value was set to true, I continue with the survey form.
- rule: Deactivate privacy_form move to cancel_reason_form
condition:
- active_loop: privacy_form
steps:
- action: privacy_form
- slot_was_set:
- requested_slot: null
- active_loop: null
- slot_was_set:
- privacy_agreement: true
- action: cancel_reason_form
- active_loop: cancel_reason_form
Of course you need to write a rule that processes the end of that form, but I think you got the point. The workaround here is to simply define several forms instead of one larger. I think one could argue if that’s a good solution or not, but since I wanted to avoid working with ActionExecutionRejection
(which possibly could have solved my problem) I think it works.
However… I still think that it would be a good idea to think about making rules applicable while there is an active loop. I am aware of the fact, that possibly this has to be considered while working with a FormAction
or CustomActions
to make sure everything fits together.
Kind regards
Julian