我正在尝试将此网聊窗口小部件连接到rasa(https://github.com/mrbot-ai/rasa-webchat),但是我在控制台中获得了此error,并且在我运行的终端上也获得了此error我的连接器脚本。
但是两天前,我的连接器中没有出现此错误,我也在Angular angular-chat-widget-rasa中使用了此程序包,但现在即使此程序包也无法与Rasa连接。
对于Webchat界面,我将此代码粘贴到了我的网站的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版用作操作系统。
请帮助我解决这个问题,谢谢
答案 0 :(得分:1)
您应该将socketIO连接器的值放在凭据.yml文件上,而不需要python脚本。
socketio:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: true
不要忘记在那之后再次训练模型。