Code Monkey home page Code Monkey logo

Comments (5)

hknajjar0 avatar hknajjar0 commented on September 27, 2024 2

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.. :)

from assister.

keyvan-m-sadeghi avatar keyvan-m-sadeghi commented on September 27, 2024 1

Probable cause

from assister.

hknajjar0 avatar hknajjar0 commented on September 27, 2024

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

from assister.

hknajjar0 avatar hknajjar0 commented on September 27, 2024

Further info:

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!

from assister.

keyvan-m-sadeghi avatar keyvan-m-sadeghi commented on September 27, 2024

This should be fixed in latest.

from assister.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.