Open stjo15 opened 5 years ago
Same issue here.. I can CURL -X POST in the command line just fine to my Rasa localserver:5005 socket. First I run this command: rasa run -m models --enable-api --log-file out.log Then I can do:
curl -X POST http://localhost:5005/webhooks/rest/webhook --data '{
"sender": "Kenz",
"message": "Hi there!"}'
Response: [{"recipient_id":"Kenz","text":"Hey! What information can I help you with?"}]%
But then using the rasa UI package and opening in browser, I say "hi" and I hear crickets.. :)
Thanks! Great project!
Maybe a gap in my understanding. Here's what I'm doing though.
Start Rasa server:
$ rasa run -m models --enable-api --log-file out.log
Create simple server (Python+Flask) to render assister/packages/rasa/index.html (call it myServer.py):
from flask import (
Flask,
render_template
)
# Create the application instance
app = Flask(__name__, template_folder=".")
# Create a URL route in our application for "/"
@app.route('/')
def home():
"""
This function just responds to the browser ULR
localhost:5000/
:return: the rendered template 'home.html'
"""
return render_template('index.html')
# If we're running in stand alone mode, run the application
if __name__ == '__main__':
app.run(debug=True)
Run myServer.py in ZShell.
$python
myServer.py``
* Serving Flask app "myServer" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 182-846-599
Open in browser: http://127.0.0.1:5000/
I see Headline "rasa-bot demo" and "Hello Rasa!" in Body. That's it.
Maybe a port issue? What port number is the UI scanning? I tried controlling Rasa's port number (different combos), still.
$ rasa run -m models --enable-api --log-file out.log -p 5002
Thanks! Best regards, hassan
I edited index.html line #14:
<rasa-bot server="http://localhost:5005"/>
Started Rasa server in ZShell:
$ rasa run -m models --enable-api --log-file out.log
2019-11-25 18:23:34 INFO root - Starting Rasa server on http://localhost:5005
2019-11-25 18:23:43 INFO absl - Entry Point [tensor2tensor.envs.tic_tac_toe_env:TicTacToeEnv] registered with id [T2TEnv-TicTacToeEnv-v0]
Started simple server in my previous post:
python myServer.py
* Serving Flask app "myServer" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 182-846-599
Then open in Firefox/Safari http://localhost:5000/. I get the Assistant UI. Then I send a message, and nothing happens. Except when I refresh the URL, my Rasa server complains:
Exception occurred while handling uri: 'http://localhost:5005/conversations/d89855fb-ead6-4d32-a001-d257698c37fe/predict'
Traceback (most recent call last):
File "/Users/hassan/miniconda3/lib/python3.7/site-packages/sanic/app.py", line 918, in handle_request
handler, args, kwargs, uri = self.router.get(request)
File "/Users/hassan/miniconda3/lib/python3.7/site-packages/sanic/router.py", line 407, in get
return self._get(request.path, request.method, "")
File "/Users/hassan/miniconda3/lib/python3.7/site-packages/sanic/router.py", line 470, in _get
raise NotFound("Requested URL {} not found".format(url))
sanic.exceptions.NotFound: Requested URL /conversations/d89855fb-ead6-4d32-a001-d257698c37fe/predict not found
Trying to get to the bottom of it. Not sure what else to do..
I can curl from command-line and get a response:
curl -X POST -i http://localhost:5005/conversations/user/messages --data "{ \"text\": \"ve
ry good\", \"sender\": \"user\" }"
HTTP/1.1 200 OK
Connection: keep-alive
Keep-Alive: 5
Access-Control-Allow-Credentials: true
Content-Length: 1673
Content-Type: application/json
{"sender_id":"user","slots":{},"latest_message":{"intent":{"name":"mood_great","confidence":0.9839841127},"entities":[],"intent_ranking":[{"name":"mood_great","confidence":0.9839841127},{"name":"mood_unhappy","confidence":0.0063061365},{"name":"greet","confidence":0.0027802626},{"name":"goodbye","confidence":0.0020190475},{"name":"affirm","confidence":0.0014041034},{"name":"bot_challenge","confidence":0.0011296462},{"name":"kenz_grind","confidence":0.0007765977},{"name":"kenz_badbatch","confidence":0.0006489555},{"name":"kenz_subscribe","confidence":0.0006073588},{"name":"deny","confidence":0.0001651671}],"text":"ve\nry good"},"latest_event_time":1574736637.2667109966,"followup_action":null,"paused":false,"events":[{"event":"action","timestamp":1574736637.1930320263,"name":"action_listen","policy":null,"confidence":null},{"event":"user","timestamp":1574736637.2667109966,"text":"ve\nry good","parse_data":{"intent":{"name":"mood_great","confidence":0.9839841127},"entities":[],"intent_ranking":[{"name":"mood_great","confidence":0.9839841127},{"name":"mood_unhappy","confidence":0.0063061365},{"name":"greet","confidence":0.0027802626},{"name":"goodbye","confidence":0.0020190475},{"name":"affirm","confidence":0.0014041034},{"name":"bot_challenge","confidence":0.0011296462},{"name":"kenz_grind","confidence":0.0007765977},{"name":"kenz_badbatch","confidence":0.0006489555},{"name":"kenz_subscribe","confidence":0.0006073588},{"name":"deny","confidence":0.0001651671}],"text":"ve\nry good"},"input_channel":null,"message_id":"5de46f9f66e946838d9fb49a011ed25c","metadata":null}],"latest_input_channel":null,"active_form":{},"latest_action_name":"action_listen"}%
For sure Rasa server is working properly.
Thanks!
This should be fixed in latest.
I've input the code snippets according to instructions in README.
I also tried with the public ip and domain name like this (the Rasa and Client app are on the same server right now):
<rasa-bot server="http://my-public-ip:5005" />
But I get thisoutput in the developer tools console:
rasa-bot.entry.js:267 POST http://localhost:5005/conversations/a3cceec6-d092-4608-a472-4d246d2ceacf/predict net::ERR_CONNECTION_REFUSED
The rasa server is running, port 5005 is open and I added this to credentials.yml:
What's wrong here? Why is there no connection?