Rasa网络聊天集成问题

时间:2020-03-29 06:27:10

标签: python socket.io rasa-core rasa

嘿,我是Rasa的新手,所以当我尝试使用命令

运行聊天机器人时
rasa run --credentials credentials.yml --cors null

仅当我使用其路径打开HTML文件时,聊天机器人才会运行。

file:///C:/Users/ansel/PycharmProjects/rasabot/index.html

因此,我想知道是否可以通过任何方法在本地主机上运行HTML文件? 当我在浏览器中输入http://localhost:5005时,它会给我: 您好,Rasa:1.8.1 而不是实际的网页

同样,当我重新运行rasa chatbot时,似乎并不能清除我以前的对话.....有什么办法可以改变这种情况吗?

我的聊天机器人似乎也没有加载任何图像。

This is the issue I face currently.

这是HTML代码:

<!DOCTYPE html>
<html>
<head>
    <title>Rasa Chatbot</title>
</head>
<body>

<div id="webchat"/>
<script src="https://storage.googleapis.com/mrbot-cdn/webchat-latest.js"></script>
// Or you can replace latest with a specific version
<script>
  WebChat.default.init({
    selector: "#webchat",
    initPayload: "/hello",
    customData: {"language": "en"}, // arbitrary custom data. Stay minimal as this will be added to the socket
    socketUrl: "http://localhost:5005",
    socketPath: "/socket.io/",
    title: "Chatbot",
</script>

</body>
</html>

我们将不胜感激,在此先感谢您。

1 个答案:

答案 0 :(得分:1)

要通过本地主机访问Chatwidget,您需要创建一个本地网络服务器。 您可以使用例如npm lite-server

您的rasa服务器已经在使用Localhost端口5005。这就是聊天机器人的运行位置。

Rasa您好:1.8.1 ”显示rasa服务器正常工作。


我假设您已经使用botfronts rasa-webchat作为界面了?

要删除您的聊天记录,您必须在chatwidget中实现以下操作:

if(Websocket.CLOSED){
localStorage.clear();
//or 
sessionStorage.clear();
}

您可以在rasa-webchat ReadMe API Part中找到更多信息。