I am trying to set up a reminder through bot and had the below actions. Reminder is getting executed after one minute as i requested. BBut dispatcher.utter_message is not appearing in screen. Could some one please help in finding the issue?
class ActionAcceptReminder(Action):
def name(self):
return 'action_accept_reminder'
def run(self, dispatcher, tracker, domain):
print("entered reminder accept action")
reminderContent = tracker.get_slot('reminderContent')
import re
hourfind = re.search('\d+|$',reminderContent)
if hourfind.group():
print('First number found = {}'.format(hourfind.group()))
numberOfHours = int(hourfind.group())
response = """Sure!! .You get relaxed. will remind you in {} hours""".format(numberOfHours)
dispatcher.utter_message(response)
return [ReminderScheduled("action_reminder", datetime.datetime.now() + timedelta(minutes=numberOfHours),kill_on_user_message=False),SlotSet('reminderContent',reminderContent)]
else:
print('Not Found')
response = """I am Sorry. Time is missiing in reminder request"""
return[]
class ActionAcceptReminder(Action):
def name(self):
return 'action_reminder'
def run(self, dispatcher, tracker, domain):
reminderContent = tracker.get_slot('reminderContent')
print("entered reminder accept action" )
#+ reminderContent)
#response = """You have scheduled a reminder {}""".format(reminderContent)
response = """You have scheduled a reminder """
dispatcher.utter_message(response)
return [SlotSet('reminderContent',reminderContent)]
and had below stories setup
## Generated Story -reminders
* Reminder{"reminderContent": "to call ibm after 2 hours"}
- slot{"reminderContent": "to call ibm after 2 hours"}
- action_accept_reminder
## Generated Story -reminders execution
- action_reminder
I am getting the message in the action server that
DEBUG:rasa_core_sdk.executor:Received request to run âaction_accept_reminderâ
entered reminder accept action
First number found = 1
DEBUG:rasa_core_sdk.executor:Successfully ran 'action_accept_reminder'
127.0.0.1 - - [2018-11-04 23:21:20] "POST /webhook HTTP/1.1" 200 472 0.002077
DEBUG:rasa_core_sdk.executor:Received request to run 'action_reminder'
entered reminder accept action
DEBUG:rasa_core_sdk.executor:Successfully ran 'action_reminder'
But message is not coming back to the client. I am trying to do this in command line.
So, I can see the action is running properly as illustrated by the print messages, so yes, the fault is happening at this line - dispatcher.utter_message(response)
Are you importing Action from rasa_core_sdk or rasa_core to inherit for your class?
Hi
I am also facing a similar issue. The scheduler job starts and action runs, but the message is only visible in logs and not on command line.
I have upgraded to latest version of Rasa Core:
rasa_core==0.13.2
rasa_core_sdk==0.12.2
rasa_nlu==0.14.4
Please let me know, if you any other details to resolve this.
Thanks.
Hi @erohmensing, I am not sure if I should start a new thread. However I am facing the same problem as these guys. Weird thing is that the reminder is able to utter_message at Rasa x. After 1minute, I saw that the message is displayed there. But when I tried using a custom channel, I am not able to see the message.
Currently the way I am testing is to run Rasa x --enable-api. My custom channel would then send a message to http://localhost:5005/webhooks/rest/webhook. I am able to receive a response but I am not able to receive the response that is scheduled 30sec after the first action.
Strangely, when I went to rasa x @ localhost:5002/conversations, I saw that the bot was able to utter_message after 30 sec.
So in conclusion, I am able to view the scheduled message after 30 sec at Rasa X but I am not able to view it at my custom channel.
I did not manage to get a response back, however the scheduler was working. So yes, the weird thing was when I access rasa x, I was able to see the response. I was just not able to see the response in my custom channel.
Which led me to the assumption that dispatcher.utter_message works for everything except when I return a ReminderScheduled in my custom channel.
Sorry, I meant the HTTP requests would be good to see if they are maybe formatted strangely and thatâs why they arenât rendering on the frontend of your custom channel
Sorry for the late reply, didnât see it! Yes I am able to print out the HTTP requests. I would send a message to localhost:5005/webhooks/rest/webhook and then get back a response from it. So from the above example, I was able to get and print the response of utter_message("testing") from my action. But as soon as I use a ReminderScheduled action to trigger another action and to utter_message("testing") from the second action that was triggered by the ReminderScheduled, the response wasnât shown!
I am not sure if it is because I have a thread that is making a request to rasa. From there, I am able to get back an immediate response. But when the scheduler is done doing the job and it utters back a message, there isnât any thread to get that response and send to the custom channel. My thoughts might be wrong though. Hope to hear from you @erohmensing, thanks!
But when the scheduler is done doing the job and it utters back a message, there isnât any thread to get that response and send to the custom channel.
Hm I would recommend using asyncio instead of threads, but I still donât assume thatâs the problem â can you put the HTTP requests for the following situation here so I can check them out?
So from the above example, I was able to get and print the response of utter_message("testing") from my action. But as soon as I use a ReminderScheduled action to trigger another action and to utter_message("testing") from the second action that was triggered by the ReminderScheduled, the response wasnât shown!