I have a form with a slot called time
, along with a response utter_ask_time
which asks “What time works for you?” I also have a FormValidationAction which validates that the filled slot includes “am” or “pm.” If not, I’d want to ask the user to specify am/pm. However, I don’t want to re-ask `utter_ask_time’. How can I achieve this logic?
Currently, I’ve defined the validate_time
method inside my FormValidationAction like this:
def validate_time(self, slot_value, dispatcher, tracker, domain):
time = tracker.get_slot("time")
if not ('am' in time or 'pm' in time):
dispatcher.utter_message(text="Could you please specify am or pm?")
return {"time": None}
return {"time": time}
but as it’s currently defined, utter_ask_time
would be automatically asked again since the time
slot remains unfilled; this is what I want to avoid. However I still want to wait for user input, and use that to set the time
slot.