通过观看以下视频,我使用Rasa-Core和Rasa-NLU创建了一个空闲的聊天机器人:https://vimeo.com/254777331。
它在Slack.com上运行得很好。但我需要的是添加到我们的网站使用代码片段。当我查到这一点时,我发现可以使用RASA Webchat (https://github.com/mrbot-ai/rasa-webchat:与聊天机器人连接的一个简单的webchat小部件)将聊天机器人添加到网站中。因此,我将这段代码粘贴在< body >标记中的网站上。
<div id="webchat"/>
<script src="https://storage.googleapis.com/mrbot-cdn/webchat-0.4.1.js"></script>
<script>
WebChat.default.init({
selector: "#webchat",
initPayload: "/get_started",
interval: 1000, // 1000 ms between each message
customData: {"userId": "123"}, // arbitrary custom data. Stay minimal as this will be added to the socket
socketUrl: "http://localhost:5500",
socketPath: "/socket.io/",
title: "Title",
subtitle: "Subtitle",
profileAvatar: "http://to.avat.ar",
})
</script> “Run_app.py”是启动聊天机器人的文件(可在视频:https://vimeo.com/254777331中找到)
Here is the code of Run_app.py :
from rasa_core.channels import HttpInputChannel
from rasa_core.agent import Agent
from rasa_core.interpreter import RasaNLUInterpreter
from rasa_slack_connector import SlackInput
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weathernlu')
agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter)
input_channel = SlackInput('xoxp-381510545829-382263177798-381274424643-a3b461a2ffe4a595e35795e1f98492c9', #app verification token
'xoxb-381510545829-381150752228-kNSPU0X7HpaS8oJaqd77TPQE', # bot verification token
'B709JgyLSSyKoodEDwOiJzic', # slack verification token
True)
agent.handle_channel(HttpInputChannel(5004, '/', input_channel))我想把这个python聊天机器人连接到“Rasa-webchat”,而不是使用Slack。但我不知道该怎么做。我试着到处找,但在网上找不到任何有用的东西。有人能帮我吗?谢谢。
发布于 2018-11-09 08:18:04
为了将Rasa Core与您的网络聊天连接起来,请执行以下操作:
credentials.yml):
socketio: user_message_evt: user_uttered bot_message_evt: bot_uttered由于您在凭据文件中指定了socketio配置,Rasa将自动启动SocketIO输入通道,然后将您网站上的脚本连接到该通道。
要添加NLU,您必须选择:
-u <path to model>命令中使用-u <path to model>指定经过训练的NLU模型Rasa核心文档也可能对你有帮助。
发布于 2018-11-13 09:33:02
为了有一个网络频道,你需要有一个前端,可以发送和接收聊天话语。有一个开放的资源项目,由黄牛。先看演示
要将您的Rasa bot与这个聊天室集成起来,您可以安装聊天室项目,如下所示。它也适用于最新的0.11Rasa版本。
发布于 2021-06-03 16:26:04
您正面临依赖问题,查找您正在使用的rasa的哪个版本以及网络聊天的哪个版本。
webchat不支持rasa版本2+
https://stackoverflow.com/questions/53187184
复制相似问题