Hi!
This could be a really simple question, but I’ve been scouring the forums for the past hour and can’t seem to find anything.
How can I use the existence of slot values to determine story paths? For example, I want to ask the user what time they’d like to book an appointment. If a date/time can be extracted from their next message – great. Continue with a confirmation message. Otherwise, ask them again to get a valid date/time.
I’m using Duckling to extract dates/times, so I have a custom action set up to fill the “time” slot, sort of like this:
time = next(tracker.get_latest_entity_values("time"), None)
return [SlotSet("time", time)]
…but I’m not sure how to handle cases where time == None
.
I’d like my bot to respond with something like “Sorry, I didn’t understand that, what time would you like to have your appointment?” and then try to extract the date/time from the next message.
But for a “happy path”, that doesn’t need to happen, and we can continue to a confirmation message. This is the “happy path” I have now:
## affirmation path
* greet
- utter_intro
* affirm
- utter_availability
* propose_time
- action_extract_time
- utter_confirm
Is there some way I can tell this story to check if the time slot is or is not None
, and then either ask again or utter the confirmation depending on the result?
Thank you!