i’m basically trying to create a chat bot using Rasa and implement it using Flask or at least find any method to implement the chatbot to my site permanently. I need help desperately and am starting to give up on using Rasa at this point. I’ve spent too many hours trying to simply deploy the chatbot onto my site. Currently all i’m trying to do is implement Rasa onto localhost:5000. I’m using websockets to connect with Flask but have been able to basically make no progress. Here’s my html template
<!doctype html>
<html>
<head>
</head>
<body>
<div id="webchat">
<script src="https://storage.googleapis.com/mrbot-cdn/webchat-0.5.8.js"></script>
<script>
WebChat.default.init({
selector: "#webchat",
initPayload: "/get_started",
interval: 1000, // 1000 ms between each message
socketUrl: "http://localhost:5000",
socketPath: "/socket.io/",
title: "SIA",
inputTextFieldHint: "Type a message...",
connectingText: "Waiting for server...",
hideWhenNotConnected: false,
fullScreenMode: true,
profileAvatar: "/static/bot.png",
openLauncherImage: 'myCustomOpenImage.png',
closeLauncherImage: 'myCustomCloseImage.png',
params: {
images: {
dims: {
width: 300,
height: 200,
}
},
storage: "session"
}
})
</script>
</div>
</body>
</html>`
here’s my server.py file which connects to the websocket
from rasa_core.channels import SocketIOInput
from rasa_core.agent import Agent
from rasa_core.interpreter import RegexInterpreter
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_core.utils import EndpointConfig
from rasa_core.policies import KerasPolicy, MemoizationPolicy
# load your trained agent
interpreter = RasaNLUInterpreter('./models/nlu/profiler/nlu')
agent = Agent.load('./models/dialogue',
interpreter=interpreter,
action_endpoint=EndpointConfig('http://localhost:5055/webhook')
#for 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=True if you want to keep the server running
s = agent.handle_channels([input_channel], 5000, serve_forever=False)
finally here’s my app.py files which uses Flask
from flask import Flask
from flask import render_template
# creates a Flask application, named app
app = Flask(__name__, static_url_path='/static')
# a route to display our html page gotten from [react-chat-widget](https://github.com/mrbot-ai/rasa-webchat)
@app.route("/")
def index():
return render_template('index.html')
# run the application
if __name__ == "__main__":
app.run(debug=True)
This is the error I receive with inspect element on my web page is
"webchat-0.5.8.js:33 GET http://localhost:5000/socket.io/?EIO=3&transport=polling&t=M-bhVfa 404 (NOT FOUND)"
If anyone can help me that would be greatly appreciated. I may be missing details that can help answer this question so if anyone needs extra info I’ll provide immediately.
One extra detail I forgot to add was my version of Flask is 1.1.1, my version of Rasa is 1.6.0, my version of rasa-nlu is 0.15. and my version of rasa-core is 0.14.5