Hi, I got some problem. my bot cant detect form interuption. it is always going through the custom validation
I always got this problem when i apply custom validation
Bot: Hi what is your fav fruit? (FORM with Validation must in [apple, grape, mango])
User: user interupting (CANCEL FORM)
Bot: Sorry i dont know your fav food, i only know apple, grape, mango
it must be
Bot: Hi what is your fav fruit? (FORM with Validation must in [apple, grape, mango])
User: user interupting (CANCEL FORM)
Bot: What can i help for you?
I find a tricky solution by adding some condition in validate_fruit_form and using a slot to trigger action_listen. if latest message is intent stop it will request a slot (ex. STOP_MARK) to trigger action_listen
# validate product type
last_intent = tracker.latest_message['intent'].get('name')
if latest_intent in ['stop', 'intent_goodbye', 'etc']:
dispatcher.utter_message(response='utter_thanks')
return {"requested_slot": "STOP_MARK"}
else:
if fruit in ['apple', 'orange', 'grape']:
return {"FRUIT": fruit}
else:
dispatcher.utter_message(text='Sorry i dont know that {} is a fruit. Please type again between apple, orange or grape'.format(fruit))
return {"FRUIT": None}