4

I am trying to connect this webchat widget to rasa (https://github.com/mrbot-ai/rasa-webchat), but I am getting this error in my console, and also this error on the terminal where I am running my connector script.

But two days ago I did not have this error in my connector, also I was using this Package in Angular angular-chat-widget-rasa, but now even this package can not connect with Rasa.

For Webchat interface, I pasted this code on my website inside the body tag.

<body>
    <div id="webchat">
        <script src="https://storage.googleapis.com/mrbot-cdn/webchat-latest.js"></script>
        <script>
            WebChat.default.init({
                selector: "#webchat",
                initPayload: "/get_started",
                interval: 1000, // 1000 ms between each message
                customData: { "sender": "django" }, // arbitrary custom data. Stay minimal as this will be added to the socket
                socketUrl: "https://localhost:5002",
                title: "Connect",
                subtitle: "The bot which connects people",
                profileAvatar: "https://rasa.com/assets/img/demo/rasa_avatar.png",
                showCloseButton: true,
                fullScreenMode: false,
                hideWhenNotConnected: false,
            })
        </script>
    </div>

</body>

and here is the code of my connector:

from rasa.core.agent import Agent
from rasa.core.interpreter import RasaNLUInterpreter
from rasa.core.channels.socketio import SocketIOInput
from rasa.utils.endpoints import EndpointConfig

agent = Agent.load("./models/20190807-131628",
                   action_endpoint=EndpointConfig(url="http://localhost:5055/webhook"))

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
)

s = agent.handle_channels([input_channel], 5002)

I am using macOS Mojave version 10.14.5 as an operating system and Rasa Version 1.0.9

Please help me solve this problem, thanks

  • Hi @Alain El Khoury , have you fixed this issue. I am getting the same issue while connecting it to angular. – Vivek Jul 20 '21 at 09:37
  • I think botfront has changed the url and also which version of rasa and rasa-sdk you are using, if you can mention these details will be helpful. – Bharath Jan 17 '22 at 11:34

1 Answers1

8

You should put the socketIO connector's values on credentials.yml file and no need for python script.

socketio:
 user_message_evt: user_uttered
 bot_message_evt: bot_uttered
 session_persistence: true

don't forget to train the model again after that.

DevMhd
  • 185
  • 1
  • 10