NextChat icon indicating copy to clipboard operation
NextChat copied to clipboard

[Bug] Unexpected return from /api/openai endpoint

Open lucasoeth opened this issue 2 years ago • 6 comments

I set the OpenAI Enpoint to "/api/openai" and when I start a new chat with arbitrary message, it returns html code instead of a response.

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charSet="utf-8"/>
      <link rel="stylesheet" href="/_next/static/css/cbfc412cab8c824e.css" data-precedence="next"/>
      <link rel="stylesheet" href="/_next/static/css/fec8607a5fb5358f.css" data-precedence="next"/>
      <link rel="stylesheet" href="/_next/static/css/765ce86c7f30c399.css" data-precedence="next"/>
      <link rel="preload" href="/_next/static/chunks/webpack-57239b9fc060ef9d.js" as="script"/>
      <link rel="preload" href="/_next/static/css/fec8607a5fb5358f.css" as="script"/>
      <link rel="preload" href="/_next/static/chunks/04b39fde-0b24a21fbfcaaf85.js" as="script"/>
      <link rel="preload" href="/_next/static/chunks/main-app-f12887ff82994d3e.js" as="script"/>
      <title>NextChat</title>
      <meta name="description" content="Your personal ChatGPT Chat Bot."/>
      <meta name="theme-color" media="(prefers-color-scheme: light)" content="#fafafa"/>
      <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#151515"/>
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
      <meta name="apple-mobile-web-app-capable" content="yes"/>
      <meta name="apple-mobile-web-app-title" content="NextChat"/>
      <meta name="apple-mobile-web-app-status-bar-style" content="default"/>
      <meta name="config" content="{&quot;version&quot;:&quot;v2.10.1&quot;,&quot;commitDate&quot;:&quot;1703691940000&quot;,&quot;commitHash&quot;:&quot;d17000975fe58c84e576f89be552c76b91bcb827&quot;,&quot;buildMode&quot;:&quot;export&quot;,&quot;isApp&quot;:true}"/>
      <link rel="manifest" href="/site.webmanifest"/>
      <script src="/serviceWorkerRegister.js" defer=""></script><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script>
   </head>
   <body>
      <div class="home_loading-content__7_JjP no-dark">
         <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="30" height="30" fill="none">
            <defs>
               <path id="bot_svg__a" d="M0 0h30v30H0z"></path>
               <path id="bot_svg__c" d="M0 0h20.455v20.455H0z"></path>
            </defs>
            <g>
               <rect fill="#E7F8FF" width="30" height="30" rx="10"></rect>
               <mask id="bot_svg__b" fill="#fff">
                  <use xlink:href="#bot_svg__a"></use>
               </mask>
               <g mask="url(#bot_svg__b)">
                  <g transform="translate(4.773 4.773)">
                     <mask id="bot_svg__d" fill="#fff">
                        <use xlink:href="#bot_svg__c"></use>
                     </mask>
                     <g mask="url(#bot_svg__d)">
                        <path fill-rule="evenodd" style="fill:#1f948c" d="M19.11 8.37c.17-.52.26-1.06.26-1.61 0-.9-.24-1.79-.71-2.57a5.24 5.24 0 0 0-4.53-2.59c-.37 0-.73.04-1.09.11A5.201 5.201 0 0 0 9.17 0h-.04C6.86 0 4.86 1.44 4.16 3.57A5.11 5.11 0 0 0 .71 6.04C.24 6.83 0 7.72 0 8.63c0 1.27.48 2.51 1.35 3.45-.18.52-.27 1.07-.27 1.61 0 .91.25 1.8.71 2.58 1.13 1.94 3.41 2.94 5.63 2.47a5.18 5.18 0 0 0 3.86 1.71h.05c2.26 0 4.27-1.44 4.97-3.57a5.132 5.132 0 0 0 3.45-2.47c.46-.78.7-1.67.7-2.58 0-1.28-.48-2.51-1.34-3.46ZM8.947 18.158c-.04.03-.08.05-.12.07.7.58 1.57.89 2.48.89h.01c2.14 0 3.88-1.72 3.88-3.83v-4.76c0-.02-.02-.04-.04-.05l-1.74-.99v5.75c0 .23-.13.45-.34.57l-4.13 2.35Zm-.67-1.153 4.17-2.38c.02-.01.03-.03.03-.05v-1.99l-5.04 2.87c-.21.12-.47.12-.68 0l-4.13-2.35c-.04-.02-.09-.06-.12-.07-.04.21-.06.43-.06.65 0 .67.18 1.33.52 1.92v-.01c.7 1.19 1.98 1.92 3.37 1.92.68 0 1.35-.18 1.94-.51ZM3.903 5.168v-.14c-.85.31-1.57.9-2.02 1.68a3.78 3.78 0 0 0-.52 1.91c0 1.37.74 2.64 1.94 3.33l4.17 2.37c.02.01.04.01.06 0l1.75-1-5.04-2.87a.64.64 0 0 1-.34-.57v-4.71Zm13.253 3.337-4.18-2.38c-.02 0-.04 0-.06.01l-1.74.99 5.04 2.87c.21.12.34.34.34.58v4.85c1.52-.56 2.54-1.99 2.54-3.6 0-1.37-.74-2.63-1.94-3.32ZM8.014 5.83c-.02.01-.03.03-.03.05v1.99L13.024 5a.692.692 0 0 1 .68 0l4.13 2.35c.04.02.08.05.12.07.03-.21.05-.43.05-.65 0-2.11-1.74-3.83-3.88-3.83-.68 0-1.35.18-1.94.51l-4.17 2.38Zm1.133-4.492c-2.15 0-3.89 1.72-3.89 3.83v4.76c0 .02.02.03.03.04l1.75 1v-5.75c0-.23.13-.45.34-.57l4.13-2.35c.04-.03.09-.06.12-.07-.7-.58-1.58-.89-2.48-.89ZM7.983 11.51l2.24 1.27 2.25-1.27V8.95l-2.25-1.28-2.24 1.28v2.56Z"></path>
                     </g>
                  </g>
               </g>
            </g>
         </svg>
         <svg xmlns="http://www.w3.org/2000/svg" width="30" height="14" fill="#fff" viewBox="0 0 120 30">
            <circle cx="15" cy="15" r="15" fill="var(--primary, red)">
               <animate attributeName="r" begin="0s" calcMode="linear" dur="0.8s" from="15" repeatCount="indefinite" to="15" values="15;9;15"></animate>
               <animate attributeName="fill-opacity" begin="0s" calcMode="linear" dur="0.8s" from="1" repeatCount="indefinite" to="1" values="1;.5;1"></animate>
            </circle>
            <circle cx="60" cy="15" r="9" fill="var(--primary, red)" fill-opacity="0.3">
               <animate attributeName="r" begin="0s" calcMode="linear" dur="0.8s" from="9" repeatCount="indefinite" to="9" values="9;15;9"></animate>
               <animate attributeName="fill-opacity" begin="0s" calcMode="linear" dur="0.8s" from="0.5" repeatCount="indefinite" to="0.5" values=".5;1;.5"></animate>
            </circle>
            <circle cx="105" cy="15" r="15" fill="var(--primary, red)">
               <animate attributeName="r" begin="0s" calcMode="linear" dur="0.8s" from="15" repeatCount="indefinite" to="15" values="15;9;15"></animate>
               <animate attributeName="fill-opacity" begin="0s" calcMode="linear" dur="0.8s" from="1" repeatCount="indefinite" to="1" values="1;.5;1"></animate>
            </circle>
         </svg>
      </div>
      <script src="/_next/static/chunks/webpack-57239b9fc060ef9d.js" async=""></script><script src="/_next/static/css/fec8607a5fb5358f.css" async=""></script><script src="/_next/static/chunks/04b39fde-0b24a21fbfcaaf85.js" async=""></script><script src="/_next/static/chunks/main-app-f12887ff82994d3e.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/cbfc412cab8c824e.css\",{\"as\":\"style\"}]\n0:\"$L2\"\n"])</script><script>self.__next_f.push([1,"3:HL[\"/_next/static/css/fec8607a5fb5358f.css\",{\"as\":\"style\"}]\n4:HL[\"/_next/static/css/765ce86c7f30c399.css\",{\"as\":\"style\"}]\n"])</script><script>self.__next_f.push([1,"5:I{\"id\":2353,\"chunks\":[\"272:static/chunks/webpack-57239b9fc060ef9d.js\",\"629:static/chunks/04b39fde-0b24a21fbfcaaf85.js\"],\"name\":\"default\",\"async\":false}\n7:I{\"id\":7330,\"chunks\":[\"272:static/chunks/webpack-57239b9fc060ef9d.js\",\"629:static/chunks/04b39fde-0b24a21fbfcaaf85.js\"],\"name\":\"\",\"async\":false}\n9:I{\"id\":9180,\"chunks\":[\"272:static/chunks/webpack-57239b9fc060ef9d.js\",\"629:static/chunks/04b39fde-0b24a21fbfcaaf85.js\"],\"name\":\"default\",\"async\":false}\na:I{\"id\":2306,\"chunks\":[\"272:static/chunks/webpack-57239b"])</script><script>self.__next_f.push([1,"9fc060ef9d.js\",\"629:static/chunks/04b39fde-0b24a21fbfcaaf85.js\"],\"name\":\"default\",\"async\":false}\n"])</script><script>self.__next_f.push([1,"2:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/cbfc412cab8c824e.css\",\"precedence\":\"next\"}]],[\"$\",\"$L5\",null,{\"buildId\":\"dtZUZrfPkIHXzRgKdHYtn\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/\",\"initialTree\":[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],\"initialHead\":[\"$L6\",null],\"globalErrorComponent\":\"$7\",\"notFound\":[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"meta\",null,{\"name\":\"config\",\"content\":\"{\\\"version\\\":\\\"v2.10.1\\\",\\\"commitDate\\\":\\\"1703691940000\\\",\\\"commitHash\\\":\\\"d17000975fe58c84e576f89be552c76b91bcb827\\\",\\\"buildMode\\\":\\\"export\\\",\\\"isApp\\\":true}\"}],[\"$\",\"link\",null,{\"rel\":\"manifest\",\"href\":\"/site.webmanifest\"}],[\"$\",\"script\",null,{\"src\":\"/serviceWorkerRegister.js\",\"defer\":true}]]}],[\"$\",\"body\",null,{\"children\":[\"$L8\",\"$undefined\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]]]}]]}],\"asNotFound\":false,\"children\":[[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"meta\",null,{\"name\":\"config\",\"content\":\"{\\\"version\\\":\\\"v2.10.1\\\",\\\"commitDate\\\":\\\"1703691940000\\\",\\\"commitHash\\\":\\\"d17000975fe58c84e576f89be552c76b91bcb827\\\",\\\"buildMode\\\":\\\"export\\\",\\\"isApp\\\":true}\"}],[\"$\",\"link\",null,{\"rel\":\"manifest\",\"href\":\"/site.webmanifest\"}],[\"$\",\"script\",null,{\"src\":\"/serviceWorkerRegister.js\",\"defer\":true}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"$L9\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"hasLoading\":false,\"template\":[\"$\",\"$La\",null,{}],\"templateStyles\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"childProp\":{\"current\":[\"$Lb\",null],\"segment\":\"__PAGE__\"},\"styles\":[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/fec8607a5fb5358f.css\",\"precedence\":\"next\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/765ce86c7f30c399.css\",\"precedence\":\"next\"}]]}]}]]}],null]}]]\n"])</script><script>self.__next_f.push([1,"c:I{\"id\":5766,\"chunks\":[\"629:static/chunks/04b39fde-0b24a21fbfcaaf85.js\",\"931:static/chunks/app/page-e54af9ade279aa29.js\"],\"name\":\"Home\",\"async\":false}\nb:[[\"$\",\"$Lc\",null,{}],false]\n8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"1\",{\"children\":\"NextChat\"}],[\"$\",\"meta\",\"2\",{\"name\":\"description\",\"content\":\"Your personal ChatGPT Chat Bot.\"}],[\"$\",\"meta\",\"3\",{\"name\":\"theme-color\",\"media\":\"(prefers-color-scheme: light)\",\"content\":\"#fafafa\"}],[\"$\",\"meta\",\"4\",{\"name\":\"theme-color\",\"media\":\"(prefers-color-scheme: dark)\",\"content\":\"#151515\"}],[\"$\",\"meta\",\"5\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1, maximum-scale=1\"}],[\"$\",\"meta\",\"6\",{\"name\":\"apple-mobile-web-app-capable\",\"content\":\"yes\"}],[\"$\",\"meta\",\"7\",{\"name\":\"apple-mobile-web-app-title\",\"content\":\"NextChat\"}],[\"$\",\"meta\",\"8\",{\"name\":\"apple-mobile-web-app-status-bar-style\",\"content\":\"default\"}]]\n"])</script>
   </body>
</html>
Screenshot 2024-01-10 at 21 15 02

None of the other end points I tested work, including https://gpt.nextapi.fun/api/proxy

Deployment Native App: v2.10.1

Desktop

  • OS: MacOS Sonoma 14.2.1

lucasoeth avatar Jan 10 '24 20:01 lucasoeth

Confirm this bug with Desktop App 2.10.1 on Ubuntu 22.04 LTS with the error: Asset api/openai/v1/chat/completions not found; fallback to api/openai/v1/chat/completions.html

SamirSaidani avatar Jan 25 '24 22:01 SamirSaidani

I think this bug its because of front end next.js

H0llyW00dzZ avatar Jan 25 '24 22:01 H0llyW00dzZ

@H0llyW00dzZ Do you know a workaround ? Can't use Desktop App anymore :-/

SamirSaidani avatar Jan 25 '24 22:01 SamirSaidani

@H0llyW00dzZ Do you know a workaround ? Can't use Desktop App anymore :-/

I have no idea how to fix it, because it is working on my desktop without any issues.

H0llyW00dzZ avatar Jan 25 '24 22:01 H0llyW00dzZ

Weird... I've tested several versions, 2.9.5 to 2.10.1 and same error... The only workaround I found is to use docker... Could you check what's happening @Yidadaa ?

SamirSaidani avatar Jan 25 '24 23:01 SamirSaidani

@SamirSaidani A work around I found is to self host nextchat using docker and then looking at the requests to see the api paths and using the self hosted api paths. I don't want to use the ones given as I don't know if they are being looked at

lucasoeth avatar Feb 13 '24 15:02 lucasoeth