Comments (6)
Ok I solved it :). Your bot.py file has to look like this:
from rasa_core.agent import Agent
from rasa_core.channels.socketio import SocketIOInput
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
# load your trained agent
interpreter = RasaNLUInterpreter("models/nlu/default/bot/")
MODEL_PATH = "models/dialogue"
action_endpoint = EndpointConfig(url="http://127.0.0.1:5055/webhook")
agent = Agent.load(MODEL_PATH, interpreter=interpreter,
action_endpoint=action_endpoint)
input_channel = SocketIOInput(
# event name for messages sent from the user
user_message_evt="user_uttered",
# event name for messages sent from the bot
bot_message_evt="bot_uttered",
# socket.io namespace to use for the messages
namespace=None
)
# set serve_forever=False if you want to keep the server running
s = agent.handle_channels([input_channel], 5500, serve_forever=True)
Put your actions folder in rasachat and don't forget to start the action server:
python -m rasa_core_sdk.endpoint --actions actions
That's all :)
from django-rasa-sockets.
Nice @Alexmhack even better! Thanks!
from django-rasa-sockets.
Nicely done, @Blind0ne. Working with custom actions needs one more command prompt or terminal in linux which makes three in total, one for django server, second for rasa socket server and the third for custom actions.
Instead of using bot.py file you can simply run the below command also
python -m rasa_core.run -d models/dialogue -u models/current/nlu --port 5500 --credentials credentials.yml
And credentials.yml
should be the same as the rasachat/credentials.yml
Reopen or create another issue anytime.
from django-rasa-sockets.
Hey, @vkresch I needed some help with this repo. There seems to be some problem with the socket.io client-side code, each request is getting a 400 BAD REQUEST error in the browser console, can you take a look by running the code and see if it's working for you.
from django-rasa-sockets.
@Alexmhack Hello, it's same situation with me. It gives always 400 when I tried to connect and chat with bot
from django-rasa-sockets.
Have a look at this issue and what do you think is the problem that is causing this unexpected error.
We have tried,
- Changing code for client-side
socket.io
in static/js/chat.js but nothing seems to work. - Adding
corsheaders
to the Django backend and allowing the rasa endpoint for CORS.
from django-rasa-sockets.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-rasa-sockets.