How to implement lex web ui chatbot to iframe by using snippet

问题描述 投票:0回答:0

我创建了 lex-web-ui 聊天机器人并与 cloudforamtion 集成。 聊天机器人在 WebAppUrl 中运行良好:[https://dynvpe5vhgxa5.cloudfront.net/iframe-snippet.html][1]

我尝试通过使用 iframe 片段在我的本地应用程序中使用该聊天机器人。

[https://dynvpe5vhgxa5.cloudfront.net/iframe-snippet.html][1]

我刚刚将脚本添加到我的 home.html 文件中,但它不起作用。

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Python ROCKS!</title>
</head>
<body>
I love Python!
Coding is fun.
</body>
<script src="https://dynvpe5vhgxa5.cloudfront.net/lex-web-ui-loader.min.js"></script>
<script>
  var loaderOpts = {
    baseUrl: 'https://dynvpe5vhgxa5.cloudfront.net/',
    shouldLoadMinDeps: true
  };
  var loader = new ChatBotUiLoader.IframeLoader(loaderOpts);
  var chatbotUiConfig = {
          /* Example of setting session attributes on parent page
          lex: {
            sessionAttributes: {
              userAgent: navigator.userAgent,
              QNAClientFilter: ''
            }
          }
          */
        };
  loader.load(chatbotUiConfig)
    .catch(function (error) { console.error(error); });
</script>
</html>

错误信息在下方。

>Error: chatbot loading time out at e.onConfigEventTimeout(iframe-component-loader.js:524:23)

如何在我的本地项目中使用我的聊天机器人?

python iframe lex aws-chatbot
© www.soinside.com 2019 - 2024. All rights reserved.