I am trying to set a reminder using Form and Action
class ReminderFormAction(FormAction):
def name(self) -> Text:
return "reminder_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["time","reminder_message"]
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {"time": [self.from_entity(entity="time")],"reminder_message": [self.from_entity(entity="reminder_message"), self.from_text()]}
def submit(self, dispatcher: CollectingDispatcher,tracker: Tracker, domain: Dict[Text, Any],) -> List[Dict]:
date=parser.parse(tracker.get_slot('time'))
reminder_message=tracker.get_slot('reminder_message')
dispatcher.utter_message('Trying to set a reminder for '+str(date))
return [ReminderScheduled("action_reminder",date,kill_on_user_message=False),SlotSet("reminder_message_for_action",reminder_message),SlotSet("reminder_message", None),SlotSet("time", None)]
class ActionAcceptReminder(Action):
def name(self):
return 'action_reminder'
def run(self, dispatcher, tracker, domain):
reminder_message = tracker.get_slot('reminder_message_for_action')
response = """You have scheduled a reminder: """+reminder_message
dispatcher.utter_message(response)
return []
# return [SlotSet("reminder_message", None),SlotSet("time", None)]
Use Case: I set a reminder in 2 minutes from now saying remind me to buy groceries I set another reminder in the next 5 seconds… since the slot values are reset in the Form, it will ask again for time and reminder_message (as expected). I set another reminder in 45 seconds from now saying remind me to buy movie tickets
What I observe is that both reminders will be triggered, but both of them have the same message “buy movie tickets”.
I want both reminders to have their respective messages, is this possible?