Hi! I have a bit of a problem, I have a form which extracts 2 dates with duckling. I use the validate_{slot} method to move the duckling time-dimesion to another slot. All this works unless a date is provided in the same message that triggers the form, if that is the case the validate function is never called. Why is that and how can i solve it?
Actions.py:
class ActionRequestVacation(FormAction):
def name(self) -> Text:
return "vacation_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["minDate", "maxDate"]
def validate_minDate(self,value: Text,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> Optional[Text]:
print("validate_minDate")
print(tracker.get_slot("time"))
if type(tracker.get_slot("time")) is dict:
return { 'minDate': tracker.get_slot("time")['from'] }
else:
return { 'minDate': tracker.get_slot("time") }
def validate_maxDate(self,value: Text,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> Optional[Text]:
print("validate_maxDate")
print(tracker.get_slot("time"))
if type(tracker.get_slot("time")) is dict:
return { 'maxDate': tracker.get_slot("time")['to'] }
else:
return { 'maxDate': tracker.get_slot("time")}
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
console.log("in slot_mappings")
return {
"minDate": [self.from_entity(entity="time")],
"maxDate": [self.from_entity(entity="time")]
}
def submit(self,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> List[Dict]:
dispatcher.utter_message()
return []
Thanks!