【发布时间】:2021-12-01 10:38:03
【问题描述】:
我正在创建一个与我们过去使用的有点不同的聊天机器人,我需要帮助和建议。这个想法是聊天机器人有一个外部界面,因为我已经读过机器人开始对话是必要的(如果不是真的,请纠正我),问题是我从来没有创建过这样的界面,当我有尝试获取创建的项目并对其进行测试,看看它看起来如何我无法让它工作,我附上了一个示例,说明它在编写 rasa 后的外观。
对话示例:
(11:22) User:Hello
(11:22) Bot: Hello, how can I help you?
(11:23) User: What will the weather be like today?
(11:23) Bot: It will rain this afternoon.
(Stands by on hold)
(14:12) Bot: It's already raining.
(14:13) User: Will it rain for a long time?
(14:13) Bot: Yes, it will be raining for about three hours
我知道如何做第一部分,直到机器人主动,但我不知道如何继续。
index.html:
<html>
<body>
<script>!(function () {
let e = document.createElement("script"),
t = document.head || document.getElementsByTagName("head")[0];
(e.src =
"https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.0/lib/index.js"),
// Replace 1.x.x with the version that you want
(e.async = !0),
(e.onload = () => {
window.WebChat.default(
{
initPayload: '/greet',
customData: { language: "en" },
socketUrl: "http://localhost:5005",
// add other props here
},
null
);
}),
t.insertBefore(e, t.firstChild);
})();
</script>
</body>
</html>
凭据.yml:
# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/messaging-and-voice-channels
rest:
# # you don't need to provide anything here - this channel doesn't
# # require any credentials
#facebook:
# verify: "<verify>"
# secret: "<your secret>"
# page-access-token: "<your page access token>"
#slack:
# slack_token: "<your slack token>"
# slack_channel: "<the slack channel>"
# slack_signing_secret: "<your slack signing secret>"
socketio:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: true
#mattermost:
# url: "https://<mattermost instance>/api/v4"
# token: "<bot token>"
# webhook_url: "<callback URL>"
# This entry is needed if you are using Rasa X. The entry represents credentials
# for the Rasa X "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5002/api"
我有几个问题:
-
为什么如果我输入 rasa shell 聊天机器人可以正常工作,但如果我输入
rasa run -m models --enable-api --cors "*" --debug并打开index.html我会得到一个空白。 [在此处输入图片说明][1] -
如何制作第二部分甚至用 rasa shell 测试它?
-
你能以不同的方式启动机器人吗,例如,开始下雨和其他时间:已经停止下雪?
有什么想法、建议、页面可以帮助我吗?
【问题讨论】: