My bot is performing very well under RASA shell, but when I’m testing it with Callbackinput channel the custom action is not updating the slot with new values. However, the SlotSet works perfectly fine in rasa shell and rasa x. The following is the custom action:
class ActionCheckDate(Action): def name(self): return ‘action_check_date’
def run(self, dispatcher, tracker, domain):
dat = tracker.get_slot('date')
time = tracker.get_slot('time')
doctor = tracker.get_slot('doctor')
dt_obj = dat+" "+time
# if dt_obj.isalpha():
print("period",dt_obj)
actu_date = period_of_time(dt_obj)
if actu_date[0]:
print("point",dt_obj)
actu_date = point_of_time(dt_obj)
set_date = actu_date[0][:10]
set_time = actu_date[0][11:16]
print(set_date,"::::",set_time)
# message = tracker.latest_message.get()
# print(message)
query = "select doc_id from docbot.doc_rel where initcap(doc_f_name)=initcap($$"+str(doctor)+"$$) or initcap(doc_l_name)=initcap($$"+str(doctor)+"$$);"
cursor.execute(query)
data = cursor.fetchall()
doc_id = data[0][0]
query = "select time_slot from docbot.appointment_rel1 where doa=$$"+str(set_date)+"$$ and doc_id=$$"+str(doc_id)+"$$ and time_slot=$$"+str(set_time)+"$$;"
cursor.execute(query)
data = cursor.fetchall()
if len(data)!=0:
if int(set_time[3:5])+time_window >= 60:
set_time = str(int(set_time[:2])+1) + ':00'
else:
set_time = set_time[:3] + str(int(set_time[3:5])+time_window)
response = """Sorry the requested time is not available. The nearest appointment is at {}. Shall I book an appointment on {} at {}""".format(set_time,set_date,set_time)
else:
response = """Shall I book an appointment on {} at {} with Dr.{}""".format(set_date,set_time,doctor)
dispatcher.utter_message(response)
#result = [SlotSet("key1", None), SlotSet("value1", None)]
#SlotSet("date", set_date) , SlotSet("time", set_time)]
result = [SlotSet('date', set_date), SlotSet("time", set_time)]
return result