Hey
My goal is to set the slot value directly in my custom action.
stories.md
## story_greet
* greet
- action_check_working_hours
- slot{"service_time" : "online"}
- utter_introduction
- utter_how_can_I_help_you
## story_greet_2
* greet
- action_check_working_hours
- slot{"service_time" : "offline"}
- utter_bye
## more_stories
*how_much
- utter_money
domain.yml
intents:
- greet
- how_much
slots:
service_time:
type: categorial
values:
- online
- offline
actions:
- utter_introduction
- utter_how_can_I_help_you
- utter_money
- action_check_working_hours
templates:
utter_introduction:
- text: "hi, I am your bot."
utter_how_can_I_help_you
- text: "My dear customer. How can I help you?"
utter_money:
- text: "the price is only 1 Dollar"
-utter_night:
- text: "Sorry my dear customer. Our service time starts at 7am and ends at 7 pm. This chat will end now. Please contact us later."
-utter_bye:
- text: "Goodbye"
actions.py
class CheckWorkingHours(Action):
def name(self): # type: () -> Text
return "action_check_working_hours"
def run(self, dispatcher, tracker, domain):
# type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict[Text, Any]]
now = dt.datetime.now()
today18pm = now.replace(hour=18, minute=0, second=0, microsecond=0)
today13am = now.replace(hour=13, minute=0, second=0, microsecond=0)
if today13am < now < today18pm:
message = 'Sorry, we are offline.'
service='offline'
#service=tracker.get_slot('online')
else:
message = 'We are open. How can I help you?'
service='online'
#service=tracker.get_slot('offline')
dispatcher.utter_message(message)
#return []
return[SlotSet("service_time", service)]
Problem:
I get this error message:
TypeError: 'NoneType' object is not callable
I guess, the way I set my slots is not correct. Can anybody help me with that?