I want the bot to deactivate the form when the user want it to stop. I have been using interactive leanring to write stories about those but nothing works like suggestions. stories.md (2.0 KB) actions.py (7.2 KB) config.yml (534 Bytes) I found there are some topics the same as mine but none is solved
Hi @TQuy
have you tried the following inside your actions.py:
overwrite the validate-function (yes, NOT the validate_{slots} one) inside your actions.py by including it. Then add the following lines to it:
reset = self.check_reset_form_action_on_intent(tracker=tracker, dispatcher=dispatcher)
if reset:
return self.deactivate()
The method definition would look like:
@staticmethod
def check_reset_form_action_on_intent(tracker: Tracker, dispatcher):
last_intent = tracker.latest_message['intent'].get('name')
if last_intent == 'reset_dialogue':
dispatcher.utter_message('Okay, what else can I do for you?')
return True
else:
return False
All you need is to define a reset_dialogue
intent which could be generally filled. Basically you would be able to reset every form action this way.
Did that work out for you?
Regards
I will try it but first I need to look for what validate-function is
Thanks a lot. After finding the validate function you talk about, I understand more how the form work and being able to modify it. So if nothing was extracted by requested slot, reject excution of the form action. Consequently, I added additional condition in to self.from_text(not_intent = 'deny')
. As a result, when intent deny
is detected, the form will stop
@TQuy
Can you post the solution which worked for you? And where can i find the validate_function
.