【问题标题】:Connecting Rasa chatbot to Webchat将 Rasa 聊天机器人连接到网络聊天
【发布时间】:2019-08-07 16:28:45
【问题描述】:

我正在尝试将此网络聊天小部件连接到 rasa (https://github.com/mrbot-ai/rasa-webchat),但我在控制台中收到此 error,在运行连接器脚本的终端上也收到此 error

但是两天前我的连接器中没有这个错误,我也在 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

请帮我解决这个问题,谢谢

【问题讨论】:

  • 嗨@Alain El Khoury,你解决了这个问题吗?将它连接到 Angular 时我遇到了同样的问题。
  • 我认为 botfront 已更改 url 以及您使用的 rasa 和 rasa-sdk 版本,如果您能提及这些细节会有所帮助。

标签: python chatbot rasa-nlu rasa-core rasa


【解决方案1】:

您应该将 socketIO 连接器的值放在 credentials.yml 文件中,不需要 python 脚本。

socketio:
 user_message_evt: user_uttered
 bot_message_evt: bot_uttered
 session_persistence: true

之后别忘了再次训练模型。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 2020-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多