Closed HovHak closed 5 years ago
Is this perhaps related to this issue https://github.com/RasaHQ/rasa_nlu/issues/3085 ? cc @erohmensing
I have followed the issue #3085 and changed my endpoint config from 'http://localhost:5055/webhook' to 'http://localhost:5005/webhooks/slack/webhook' also tried it with 5055, but still, it performs the same way i again see the message is received but nor replies from the bot
@erohmensing is there any way I can debug and see what can be done to resolve this?, I am still struggling to understand what can cause this. Look forward to hearing from you).
@HovHak I'm going to set up a slack bot today to see if I run into the same issue -- If I do, i'll try to figure out what's causing it, and if I don't, we can look at the differences in our configurations. I'll keep you updated.
Okay, I've successfully set up a bot on Core 0.13.3, so it definitely does work (barring a button bug that has already been fixed). Some things I notice in your code:
input_channel = SlackInput('xoxp-607403756646-592126442018-607420295142-824b897a97a9d1a110681e20bac254db','xoxb-607403756646-603559674128-oIUzV7UMm3g81Nl3HrHzQF5b','nsDsPdiNInDw2IESZM01Dqlq'
)
This auth token looks like an OAuth access token rather than a Bot User OAuth access token, which usually starts with xoxb
. Try switching the access token to see if that helps (I tested what happens if you use the other token, and you get 200s but no reply).
I otherwise wonder what your second argument 'nsDsPdiNInDw2IESZM01Dqlq'
is -- this is supposed to be the slack channel, or if you leave this argument out, the bot will respond in the app. Since you look to be talking to the bot in the app, I would suggest leaving out this argument for now to see if you can get replies from within the app.
Can you try changing that line to
input_channel = SlackInput(slack_token=<your bot user Oath token>)
and tell me if you have any more luck? Keep the endpoint config as it was before.
Okay, I've successfully set up a bot on Core 0.13.3, so it definitely does work (barring a button bug that has already been fixed). Some things I notice in your code:
input_channel = SlackInput('xoxp-607403756646-592126442018-607420295142-824b897a97a9d1a110681e20bac254db','xoxb-607403756646-603559674128-oIUzV7UMm3g81Nl3HrHzQF5b','nsDsPdiNInDw2IESZM01Dqlq' )
This auth token looks like an OAuth access token rather than a Bot User OAuth access token, which usually starts with
xoxb
. Try switching the access token to see if that helps (I tested what happens if you use the other token, and you get 200s but no reply).I otherwise wonder what your second argument
'nsDsPdiNInDw2IESZM01Dqlq'
is -- this is supposed to be the slack channel, or if you leave this argument out, the bot will respond in the app. Since you look to be talking to the bot in the app, I would suggest leaving out this argument for now to see if you can get replies from within the app.Can you try changing that line to
input_channel = SlackInput(slack_token=<your bot user Oath token>)
and tell me if you have any more luck? Keep the endpoint config as it was before.
hi there, thanx for coming back)). i got read of the slack channel and bot user Outh acces token with just leaving the first one and it worked.
however, it did not reply to the rest of my messages things like what is the weather like i presume there is an issue with connecting to the weather apixu
it seems that on my actions class it struggles import 'from apixu.client import ApixuClient' I have successfully installed the WeatherAPIXU but can't find any client dependencies in it to call I am using an example of code from https://github.com/JustinaPetr/Weatherbot_Tutorial/blob/master/Full%20Code%20%5BLatest%20release%20of%20Rasa%20NLU%20and%20Rasa%20Core%5D/actions.py
is it up to date?
Ah sorry, perhaps you missed my last comment -- keep the endpoint config as before so that it matches the one in your endpoints.yml (it shouldn't need any slack stuff). Are you running the action server before you try to access it?
Ah sorry, perhaps you missed my last comment -- keep the endpoint config as before so that it matches the one in your endpoints.yml (it shouldn't need any slack stuff). Are you running the action server before you try to access it?
thank you again for coming back),
yes i did not touch the endpoint.yml it is the same as it was, and no i am not running action server i have action class with all the actions in it where the bot suppose to call when it comes to actionWeather or actionScheduleMetting
just like in this page https://github.com/JustinaPetr/Weatherbot_Tutorial/blob/master/Full%20Code%20%5BLatest%20release%20of%20Rasa%20NLU%20and%20Rasa%20Core%5D/actions.py
Ah yes so what happens is if you have custom actions, you have to run a custom action server. I do this by running (in a different terminal window)
python -m rasa_core_sdk.endpoint --actions actions
this gives your code access to run the actions in your actions.py
file. You should see something like this if you've done it successfully:
2019-04-16 13:42:20 INFO __main__ - Starting action endpoint server...
2019-04-16 13:42:20 INFO rasa_core_sdk.executor - Registered function for 'restaurant_form'.
2019-04-16 13:42:20 INFO __main__ - Action endpoint is up and running. on ('0.0.0.0', 5055)
Make sure that the url in the action_endpoint = EndpointConfig ...
matches that endpoint in your endpoints.yml
before re-running your code.
Ah yes so what happens is if you have custom actions, you have to run a custom action server. I do this by running (in a different terminal window)
python -m rasa_core_sdk.endpoint --actions actions
this gives your code access to run the actions in your
actions.py
file. You should see something like this if you've done it successfully:2019-04-16 13:42:20 INFO __main__ - Starting action endpoint server... 2019-04-16 13:42:20 INFO rasa_core_sdk.executor - Registered function for 'restaurant_form'. 2019-04-16 13:42:20 INFO __main__ - Action endpoint is up and running. on ('0.0.0.0', 5055)
Make sure that the url in the
action_endpoint = EndpointConfig ...
matches that endpoint in yourendpoints.yml
before re-running your code.
i am getting an error
on the cmd i am on the directory where i have both my endpint.yml(and yes i made sure that it is the same as in my code) and the actions.py
There shouldn't be a space between --
and actions
. Try again, or just copy/paste my command exactly.
There shouldn't be a space between
--
andactions
. Try again, or just copy/paste my command exactly. ohh i, this is what i got
Hmm okay. Can you paste your actions code? It looks like there might be something wrong in your actionScheduleMetting
code since it successfully registers action_weather but not your meeting scheduling code. What version of rasa_core_sdk are you running?
Hmm okay. Can you paste your actions code? It looks like there might be something wrong in your
actionScheduleMetting
code since it successfully registers action_weather but not your meeting scheduling code. What version of rasa_core_sdk are you running?
sure
Content of actions.py:
from rasa_core.actions import Action
# from rasa_core_sdk import Action
# from rasa_core_sdk.events import SlotSet
from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet
#from WeatherAPIXU.
class ActionWeather(Action):
def name(self):
return 'action_weather'
def run(self, dispatcher, tracker, domain):
from apixu.client import ApixuClient
api_key = '333' # your apixu key
client = ApixuClient(api_key)
loc = tracker.get_slot('location')
current = client.getcurrent(q=loc)
country = current['location']['country']
city = current['location']['name']
condition = current['current']['condition']['text']
temperature_c = current['current']['temp_c']
humidity = current['current']['humidity']
wind_mph = current['current']['wind_mph']
response = """It is currently {} in {} at the moment. The temperature is {} degrees, the humidity is {}% and the wind speed is {} mph.""".format(
condition, city, temperature_c, humidity, wind_mph)
dispatcher.utter_message(response)
return [SlotSet('location', loc)]
class ActionScheduleMeeting(Action):
@property
def name(self):
return 'action_schedule_meeting'
def run(self):
print('scheduling meeting is completed! ')
pass
class ActionShowMeeting(Action):
def name(self):
return 'action_show_meeting'
def run(self, dispatcher, tracker, domain):
dispatcher.utter_message('Here is the meeting information!')
return []
Ah, try getting rid of the @property
tag in ActionScheduleMeeting. Also, that run
method will need the dispatcher, tracker, domain
arguments as well as a return value like the run method of ActionShowMeeting.
Ah, try getting rid of the
@property
tag in ActionScheduleMeeting. Also, thatrun
method will need thedispatcher, tracker, domain
arguments as well as a return value like the run method of ActionShowMeeting.
ok i did as you said and it started running except it does not perform any action when i ask it on the slack
I think this might be because of the domain and story file i will attach it just in case. Content of chat_domain.yml:
intents:
- schedule_meeting
- search_for_meeting
- greet
- inform
- goodbye
entities:
- meeting
- time
- location
slots:
location:
type: text
time:
type: text
meeting:
type: text
templates:
utter_greet:
- 'Hello, how can I help you?'
- 'Hi, I am here to help.'
utter_goodbye:
- 'Talk to you later.'
- 'Bye bye :('
utter_ask_meeting_time:
- 'What time would you like me to schedule your meeting?'
utter_ask_location:
- 'In what location?'
actions:
- utter_greet
- utter_goodbye
- utter_ask_meeting_time
- utter_ask_location
- actions.ActionShowMeeting
- actions.ActionWeather
Content of stories.md:
## story 01
*greet
- utter_greet
*goodbye
- utter_goodbye
*schedule_meeting
- utter_ask_meeting_time
*search_for_meeting
- actions.ActionShowMeeting
*inform
- actions.ActionWeather
* greet
- utter_greet
* search_for_meeting
- action_restart
## Generated Story -4387380784712563648
* inform
- utter_ask_location
* inform{"location": "italy"}
- slot{"location": "italy"}
- actions.ActionWeather
Yes, it is likely because of your stories -- you need to make sure you have stories for your flows. Right now the only thing your bot knows about that someone would do after greeting is saying goodbye, so when you search_for_meeting, it doesn't know what to do.
At this point, this issue has diverted from the original issue, and is more about usage than a bug. I would recommend that you work on fleshing out your stories (and perhaps your training data) while testing your bot locally through the command line (best way to train a new bot is through interactive learning) before even trying to deploy it on slack -- this will let you know if something is going wrong in the code before the issues are masked by the connector. If you need help implementing your bot in general, please ask our awesome community for help on the forum.
Yes, it is likely because of your stories -- you need to make sure you have stories for your flows. Right now the only thing your bot knows about that someone would do after greeting is saying goodbye, so when you search_for_meeting, it doesn't know what to do.
At this point, this issue has diverted from the original issue, and is more about usage than a bug. I would recommend that you work on fleshing out your stories (and perhaps your training data) while testing your bot locally through the command line (best way to train a new bot is through interactive learning) before even trying to deploy it on slack -- this will let you know if something is going wrong in the code before the issues are masked by the connector. If you need help implementing your bot in general, please ask our awesome community for help on the forum.
Thank you you have been of great support. I know how to run interactive training and will do so, after i am finished retraining my NLU model i will retrain and see what works best for it. thank you very much. only there is one thing that's bothering me. in the actions.py my code on PyCharm does not recognize the library from apixu.client import ApixuClient although i have installed package WeatherAPIXU has it been changed can i still get the weather check from the geolocations?
I am using the code provided in https://github.com/JustinaPetr/Weatherbot_Tutorial/blob/master/Full%20Code%20%5BLatest%20release%20of%20Rasa%20NLU%20and%20Rasa%20Core%5D/actions.py
hmm it doesn't look like it comes from WeatherAPIXU package but rather the apixu package on github. Make sure to download all of the requirements in the requirements file using
pip install -r requirements.txt
which should get the library from git+https://github.com/apixu/apixu-python.git
for you.
hmm it doesn't look like it comes from WeatherAPIXU package but rather the apixu package on github. Make sure to download all of the requirements in the requirements file using
pip install -r requirements.txt
which should get the library from
git+https://github.com/apixu/apixu-python.git
for you.
is there any way to install it on PyCharm ? i am running thorugh its venv where it has all the packages installed
Hm, for that i'm not sure, I don't use PyCharm. I would say either google it (the answer with 11 upvotes here looks promising (change the URL to the one in my last comment of course) -- but honestly the easiest way is to just use the Terminal window of your Pycharm to navigate to the project directory with the requirements.txt
(you should already be in your venv, but if not, activate it) and use the command to install everything. From the looks of it you might have to restart pycharm to get it to recognize that you have the package installed.
On another note -- if you test your bot and it actually does get the weather (regardless of whether pycharm seems to recognize the library), you're fine.
Hm, for that i'm not sure, I don't use PyCharm. I would say either google it (the answer with 11 upvotes here looks promising (change the URL to the one in my last comment of course) -- but honestly the easiest way is to just use the Terminal window of your Pycharm to navigate to the project directory with the
requirements.txt
(you should already be in your venv, but if not, activate it) and use the command to install everything. From the looks of it you might have to restart pycharm to get it to recognize that you have the package installed.On another note -- if you test your bot and it actually does get the weather (regardless of whether pycharm seems to recognize the library), you're fine.
thank you again i will see to that, you are doing amazing job!