Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat.sendAndAwaitResponse() doesn't properly handle waiting room #158

Closed
SeoulSKY opened this issue Mar 18, 2024 · 2 comments
Closed

Chat.sendAndAwaitResponse() doesn't properly handle waiting room #158

SeoulSKY opened this issue Mar 18, 2024 · 2 comments

Comments

@SeoulSKY
Copy link

Version: 1.2.7

Looks like this line throws this error.

[2024-03-18T22:40:15.521] [ERROR] default - {
  name: 'SyntaxError',
  message: "Unexpected '<'",
  at: 1,
  text: '<!DOCTYPE html>\n' +
    '<html>\n' +
    '  <head>\n' +
    '    <title>Waiting Room powered by Cloudflare</title>\n' +
    '    <meta name="viewport" content="width=device-width, initial-scale=1" />\n' +
    '    <style type="text/css">\n' +
    '      * {\n' +
    '        box-sizing: border-box;\n' +
    '      }\n' +
    '\n' +
    '      html,\n' +
    '      body,\n' +
    '      #wrapper {\n' +
    '        padding: 0;\n' +
    '        margin: 0;\n' +
    '        height: 100%;\n' +
    '      }\n' +
    '\n' +
    '      #wrapper {\n' +
    '        display: table;\n' +
    '        width: 100%;\n' +
    '      }\n' +
    '\n' +
    '      main,\n' +
    '      footer {\n' +
    '        /* Old browsers */\n' +
    '        display: block;\n' +
    '        /* Modern browsers */\n' +
    '        display: table-row;\n' +
    '      }\n' +
    '\n' +
    '      body {\n' +
    "        font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI',\n" +
    "          Roboto, Oxygen, Ubuntu, 'Helvetica Neue', Arial, sans-serif;\n" +
    '        font-size: 16px;\n' +
    '        margin: 0;\n' +
    '        padding: 0;\n' +
    '      }\n' +
    '\n' +
    '      main .content-container {\n' +
    '        max-width: 1024px;\n' +
    '      }\n' +
    '\n' +
    '      .center {\n' +
    '        height: 100%;\n' +
    '        display: flex;\n' +
    '        align-items: center;\n' +
    '      }\n' +
    '\n' +
    '      .content-container {\n' +
    '        width: 100%;\n' +
    '        min-width: 400px;\n' +
    '        margin: 0 auto;\n' +
    '        padding: 32px 64px;\n' +
    '        display: flex;\n' +
    '      }\n' +
    '\n' +
    '      @media (max-width: 900px) {\n' +
    '        .content-container {\n' +
    '          display: block;\n' +
    '        }\n' +
    '      }\n' +
    '\n' +
    '      main .content-container section {\n' +
    '        flex: 1 0 0;\n' +
    '        display: flex;\n' +
    '        flex-direction: column;\n' +
    '      }\n' +
    '\n' +
    '      footer {\n' +
    '        height: 100px;\n' +
    '        background: #138eed;\n' +
    '        color: white;\n' +
    '        font-size: 12px;\n' +
    '      }\n' +
    '\n' +
    '      footer .content-container {\n' +
    '        justify-content: space-between;\n' +
    '      }\n' +
    '\n' +
    '      p {\n' +
    '        line-height: 1.5;\n' +
    '        max-width: 34rem;\n' +
    '      }\n' +
    '\n' +
    '      h1 {\n' +
    '        font-size: 32px;\n' +
    '        margin: 0 0 32px 0;\n' +
    '      }\n' +
    '\n' +
    '      h2 {\n' +
    '        font-size: 20px;\n' +
    '        margin: 0 0 20px 0;\n' +
    '      }\n' +
    '\n' +
    '      .links {\n' +
    '        color: #cac8c8;\n' +
    '        margin-top: 15px;\n' +
    '        display: flex;\n' +
    '        align-items: flex-end;\n' +
    '      }\n' +
    '\n' +
    '      .links a,\n' +
    '      .links a:visited {\n' +
    '        text-decoration: none;\n' +
    '        color: #cac8c8;\n' +
    '      }\n' +
    '\n' +
    '      .logo {\n' +
    '        display: flex;\n' +
    '        align-items: flex-end;\n' +
    '      }\n' +
    '\n' +
    '      .logo .cloudflare-logo {\n' +
    '        width: 140px;\n' +
    '        margin-right: 1rem;\n' +
    '      }\n' +
    '    </style>\n' +
    '  </head>\n' +
    '\n' +
    '  <body>\n' +
    '    <div id="wrapper">\n' +
    '      <main>\n' +
    '        <div class="center">\n' +
    '          <section class="content-container">\n' +
    '\n' +
    '\n' +
    '            <section>\n' +
    '<img src="https://characterai.io/logo-light-bg.png" alt="logo" style="max-width: 400px;margin-left:-34px">\n' +
    '<br/>\n' +
    '              <h1>\n' +
    '                You are now in line.\n' +
    '                <br />\n' +
    '                Thanks for your patience.\n' +
    '              </h1>\n' +
    '            </section>\n' +
    '            <section>\n' +
    '\n' +
    '              <h2>\n' +
    '                        Your estimated wait time is 1 minute...\n' +
    `            <a href="https://plus.character.ai" style="text-decoration:none;"><div style='background-color: #000000 ;width: 100%; padding: 10px 30px;color: white;display: flex;justify-content: center; align-items: center;font-size: 20px;border-radius: 16px; cursor: pointer;margin-top: 16px;'>c.ai+ user? Click here to skip the line!</div></a>\n` +
    '            <br >\n' +
    `            <a href="https://plus.character.ai" target="_blank" style="text-decoration:none;"><div style='background-color: #056DFF; width: 100%; padding: 10px 30px;color: white;display: flex;justify-content: center; align-items: center;font-size: 20px;border-radius: 16px; cursor: pointer;'>Get c.ai+</div></a>\n` +
    '              </h2>\n' +
    '              <p>\n' +
    '                We are experiencing a high volume of traffic and using a virtual\n' +
    '                queue to limit the number of users on Character.AI at the same\n' +
    '                time.\n' +
    '              </p>\n' +
    '             <p>\n' +
    "                 Your Characters will be waiting for you when it's your turn!\n" +
    '             </p>\n' +
    '              <p>\n' +
    '                <strong>\n' +
    '                    This page will automatically refresh, please do not close your\n' +
    '                    browser.\n' +
    '                </strong>\n' +
    '              </p>\n' +
    '              <p>\n' +
    '                <strong>\n' +
    '                  Last updated\n' +
    '                  <span id="last-updated"></span>\n' +
    '                </strong>\n' +
    '              </p>\n' +
    '            </section>\n' +
    '          </section>\n' +
    '        </div>\n' +
    '      </main>\n' +
    '    </div>\n' +
    '    <script>\n' +
    '      var date = new Date();\n' +
    "      document.getElementById('year').innerText = date.getFullYear();\n" +
    '      document.getElementById(\n' +
    "        'last-updated'\n" +
    '      ).innerText = date.toLocaleTimeString();\n' +
    '    </script>\n' +
    `  <script>(function(){var js = "window['__CF$cv$params']={r:'8668b9302de58140',t:'MTcxMDgwMTYxNS40MzEwMDA='};_cpo=document.createElement('script');_cpo.nonce='',_cpo.src='/cdn-cgi/challenge-platform/scripts/jsd/main.js',document.getElementsByTagName('head')[0].appendChild(_cpo);";var _0xh = document.createElement('iframe');_0xh.height = 1;_0xh.width = 1;_0xh.style.position = 'absolute';_0xh.style.top = 0;_0xh.style.left = 0;_0xh.style.border = 'none';_0xh.style.visibility = 'hidden';document.body.appendChild(_0xh);function handler() {var _0xi = _0xh.contentDocument || _0xh.contentWindow.document;if (_0xi) {var _0xj = _0xi.createElement('script');_0xj.innerHTML = js;_0xi.getElementsByTagName('head')[0].appendChild(_0xj);}}if (document.readyState !== 'loading') {handler();} else if (window.addEventListener) {document.addEventListener('DOMContentLoaded', handler);} else {var prev = document.onreadystatechange || function () {};document.onreadystatechange = function (e) {prev(e);if (document.readyState !== 'loading') {document.onreadystatechange = prev;handler();}};}})();</script></body>\n` +
    '</html>'
}

The problem is that it tries to parse HTML waiting room page into JSON

@realcoloride
Copy link
Owner

Hello! That is indeed annoying and a bug. I will try to look for a workaround on this.

@realcoloride realcoloride mentioned this issue Jul 23, 2024
9 tasks
@realcoloride
Copy link
Owner

This has been closed because sendAndAwaitResponse() doesnt exist anymore in 2.0.
To follow the development roadmap: #180

Feel free to re-open an issue if you have any problems.
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants