Ala*_*ury 4 python chatbot rasa-nlu rasa-core 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>Run Code Online (Sandbox Code Playgroud)
这是我的连接器的代码:
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)
Run Code Online (Sandbox Code Playgroud)
我使用 macOS Mojave 版本 10.14.5 作为操作系统和 Rasa 版本 1.0.9
请帮我解决这个问题,谢谢
小智 6
您应该将 socketIO 连接器的值放在credentials.yml 文件中,不需要python 脚本。
socketio:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: true
Run Code Online (Sandbox Code Playgroud)
之后不要忘记再次训练模型。
| 归档时间: |
|
| 查看次数: |
2326 次 |
| 最近记录: |