【问题标题】:chatbot interrupts conversation聊天机器人打断对话
【发布时间】: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"

我有几个问题:

  1. 为什么如果我输入 rasa shell 聊天机器人可以正常工作,但如果我输入 rasa run -m models --enable-api --cors "*" --debug 并打开 index.html 我会得到一个空白。 [在此处输入图片说明][1]

  2. 如何制作第二部分甚至用 rasa shell 测试它?

  3. 你能以不同的方式启动机器人吗,例如,开始下雨和其他时间:已经停止下雪

有什么想法、建议、页面可以帮助我吗?

谢谢! [1]:https://i.stack.imgur.com/shcz0.png

【问题讨论】:

    标签: python rasa


    【解决方案1】:

    为什么如果我输入 rasa shell 聊天机器人可以正常工作,但如果我输入 rasa run -m models --enable-api --cors "*" --debug 并打开 index.html 我得到一个空白。 enter image description here

    我建议使用官方的rasa chat widget 作为你的前端。如果您对此有任何疑问,可以在rasa forum 中提问。如果您发现了错误,可以在rasa open source repo 中提交错误报告。

    如何制作第二部分甚至用 rasa shell 进行测试?

    how to get the bot to start the conversation 上的用户文档应该可以帮助您入门。

    你能以不同的方式启动机器人吗,例如,它正在启动 下雨和其他时间:已经停止下雪了?

    您可以向机器人发送触发意图,该意图将触发机器人所需的响应。有关详细信息,请参阅问题的答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多