我正在尝试将此网络聊天小部件连接到 rasa ( https://github.com/mrbot-ai/rasa-webchat ),但我在控制台中收到此错误,在我运行的终端上也收到此错误连接器脚本。
但是两天前我的连接器中没有这个错误,我也在 Angular angular-chat-widget-rasa中使用这个包,但现在即使这个包也无法与 Rasa 连接。
对于网络聊天界面,我将此代码粘贴在我的网站上的 body 标记内。
<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>
这是我的连接器的代码:
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)
我使用 macOS Mojave 版本 10.14.5 作为操作系统和 Rasa 版本 1.0.9
请帮我解决这个问题,谢谢