Hi, Sam, thanks for your reply, I tired this solution, nearly working, but still not fully meet my requirement, there’s probably misunderstanding in my code:
async def run(self, dispatcher, tracker, domain):
events = await self.validate(dispatcher, tracker, domain)
logger.info("event:{}".format(events))
temp_tracker = tracker.copy()
for e in events:
if e["event"] == "slot":
temp_tracker.slots[e["name"]] = e["value"]
required_slots = self.required_slots(temp_tracker)
logger.info("required_slots:{}".format(required_slots))
for slot_name in required_slots:
if temp_tracker.slots.get(slot_name) is None:
# The slot is not filled yet. Request the user to fill this slot next.
events.append(SlotSet("requested_slot", slot_name))
logger.info("events:{}".format(events))
return events
# All slots are filled.
events.append(SlotSet("requested_slot", None))
return events
I can set both slots at the the same time by doing this, but another unexpected problem occured here, the validate_slot funtion start validate from the very beginning of the run method and replace some of the slot values in the original events, which cause trouble when setting required_slots
I’m sure there’s another way to do that, but I don’t really want to modify the SDK source code, all I want to achieve is the same logic as the old form action