Rasa聊天机器人的WebSocket连接

ghhkc1vu  于 2023-04-21  发布在  其他
关注(0)|答案(1)|浏览(335)

我用这个脚本来集成rasachatbot但

!( function () {
           var productId = "{{productName}}";
           var src = "{{ image }}";
         let e = document.createElement("script"),
          t = document.head || document.getElementsByTagName("head")[0];
        (e.src = "https://cdn.jsdelivr.net/npm/rasa-webchat/lib/index.js"),
          // Replace 1.x.x with the version that you want
          (e.async = !0),
          (e.onload = () => {
            window.WebChat.default(
              {
           initPayload: `/inform_product{"product":"${productId}"}`,
           customData: { "language":"en" },
           //metadata:'{"product_id":"7322662371510"}'
                socketUrl: "chat.store.in/",
                title: "ANTRIKSH",
                subtitle: "Welcome to our Store",
           profileAvatar:"https://cdn.shopify.com/s/files/1/0615/4600/4662/files/4CodeZyng-Brand-Look.png?v=1654590242",
                // add other props here
                // socketPath: "/socket.io/",
           
              },
              null
            );
          }),
          t.insertBefore(e, t.firstChild);
      })();
      localStorage.clear();

我有时会遇到这个错误,有时聊天机器人会弹出,我使用ec2来托管聊天机器人

WebSocket connection to 'wss://chat.store.in/socket.io/?EIO=4&transport=websocket&sid=2H2pkFDfNx8OhAzRAAE7' failed:

Rasa聊天机器人应该弹出每次

xtfmy6hx

xtfmy6hx1#

删除WebSocket解决了这个问题websocket= undefined; delete WebSocket;

相关问题