I have a form that extracts two dates with duckling. But the slot_mapping doesn’t work if one of the dates is supplied in the message.
Working example
(Me) - I want a vacation
(Bot) - When will you leave?
(Me) - the 5th
(Bot) - When will you get back?
(Me) - the 7th
this gives me the expected result:
The form parameters are:
- minDate: 2020-03-05T00:00:00.000+01:00
- maxDate: 2020-03-07T00:00:00.000+01:00
Not working example
(Me) - I want a vacation the 5th
(Bot) - When will you get back?
(Me) - the 7th
Gives me the result:
The form parameters are:
- minDate: 5th
- maxDate: 2020-03-07T00:00:00.000+01:00
As you can see in the latest example the slot mapping doesn’t work correctly when a date is provided when starting the form, how can i solve this?
ActionForm
class ActionRequestVacation(FormAction):
def name(self) -> Text:
return "vacation_form"
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"minDate": self.from_entity(entity="time"),
"maxDate": self.from_entity(entity="time")
}
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["minDate", "maxDate"]
def submit(self,dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any],) -> List[Dict]:
print(tracker.get_slot("time"))
dispatcher.utter_message()
return []