acheong08 / ChatGPT

Reverse engineered ChatGPT API
GNU General Public License v2.0
28.04k stars 4.48k forks source link

[Bug]: 504 after 1 minute of asking #866

Closed UNIDY2002 closed 1 year ago

UNIDY2002 commented 1 year ago

Is there an existing issue for this?

What happened?

Great thanks to your project and it helps me a lot!

I am asking a long question, and it might take a long time for ChatGPT to answer.

If the answer does not arrive in 60s, I receive a stream timeout error (http status code: 504) instead.

I tried out the same question in the browser, and if I waited a longer time, I would be able to get a full response.

Is this a limitation from ChatGPT or is it intentionally restricted by the reverse engine server?

Thank you!

Steps to reproduce the problem

  1. Copy the code from Basic example (single result)
  2. Use a very long prompt (in my case, my prompt has more than 2000 Chinese characters)
  3. Remember to wrap the script in try...except and print the fields code, message of the error thrown
  4. You will get code == 504 and message == "stream timeout".

What should have happened?

Should receive the answer successfully.

Version where the problem happens

Name: revChatGPT Version: 2.3.3 Summary: ChatGPT is a reverse engineering of OpenAI's ChatGPT API Home-page: https://github.com/acheong08/ChatGPT Author: Antonio Cheong Author-email: acheong@student.dalat.org License: GNU General Public License v2.0 Location: /usr/lib/python3.10/site-packages Requires: OpenAIAuth, requests Required-by:

What Python version are you running this with?

Python 3.10.9

What is your operating system ?

Linux

Command Line Arguments

No

Console logs

I get `code == 504` and  `message == "stream timeout"`.

Additional information

No response

acheong08 commented 1 year ago

ChatGPT at capacity

UNIDY2002 commented 1 year ago

Thank you, but I have no problem logging in with the script, and it seems that the error occurs after the POST to api/conversation is made. Do you have any ideas on the issue?

acheong08 commented 1 year ago

It's working fine for me. Try to modify the code to print every line and see if there is a parsing error on my side

UNIDY2002 commented 1 year ago

All right, it seems that the issue occurs here

print("before post", data)
response = self.session.post(
    url=BASE_URL + "api/conversation",
    data=json.dumps(data),
    timeout=timeout,
    stream=True,
)
print("after post")
self.__check_response(response)
print("after check")

And the error is thrown in __check_response, because response.status_code == 504.

The parsing of this script is definitely correct, and I am just curious about the cause of this 504 response: is it generated by ChatGPT or the reverse engine server? (Well, I mean no offense if this question is related to your secret implementations... I am asking this due to my own job, and I have absolutely no relationship with OpenAI.)

Okay, it seems that ChatGPT is at capacity again, and I cannot reproduce the error now...

Maybe we can discuss this problem when the ChatGPT service is back :joy:

Thank you for your response and understanding.

acheong08 commented 1 year ago

The parsing of this script is definitely correct, and I am just curious about the cause of this 504 response: is it generated by ChatGPT or the reverse engine server? (Well, I mean no offense if this question is related to your secret implementations... I am asking this due to my own job, and I have absolutely no relationship with OpenAI.)

All response codes are from OpenAI except 429 which comes from me

UNIDY2002 commented 1 year ago

Ok, thank you for your kind response!

phamxtien commented 1 year ago

Today V1 get error gpt.pawan.krd 504: Gateway time-out

acheong08 commented 1 year ago

What version are you using? pip install --upgrade revChatGPT

That isn't my endpoint

phamxtien commented 1 year ago

I got newest code from this https://github.com/acheong08/ChatGPT/tree/main/src/revChatGPT

acheong08 commented 1 year ago

The string: gpt.pawan.krd shows up nowhere in the code

phamxtien commented 1 year ago

I have looked in the code but not found that string, but when print its response, the result as below: gpt.pawan.krd | 504: Gateway time-out show in title tag and in the link to cloudflare.com

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<meta http-equiv="refresh" content="0">

<title>gpt.pawan.krd | 504: Gateway time-out</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" />

</head>
<body>
<div id="cf-wrapper">

    <div id="cf-error-details" class="p-0">
        <header class="mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-8">
            <h1 class="inline-block sm:block sm:mb-2 font-light text-60 lg:text-4xl text-black-dark leading-tight mr-2">

              <span class="inline-block">Gateway time-out</span>
              <span class="code-label">Error code 504</span>
            </h1>
            <div>
               Visit <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_504&utm_campaign=gpt.pawan.krd" target="_blank" rel="noopener noreferrer">cloudflare.com</a> for more information.
            </div>
            <div class="mt-3">2023-06-27 05:02:21 UTC</div>
        </header>

        <div class="my-8 bg-gradient-gray">
            <div class="w-240 lg:w-full mx-auto">
                <div class="clearfix md:px-8">

<div id="cf-browser-status" class=" relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">

    <span class="cf-icon-browser block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>

  </div>
  <span class="md:block w-full truncate">You</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">

    Browser

  </h3>
  <span class="leading-1.3 text-2xl text-green-success">Working</span>
</div>

<div id="cf-cloudflare-status" class=" relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">
    <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_504&utm_campaign=gpt.pawan.krd" target="_blank" rel="noopener noreferrer">
    <span class="cf-icon-cloud block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-ok w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>
    </a>
  </div>
  <span class="md:block w-full truncate">Singapore</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">
    <a href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_504&utm_campaign=gpt.pawan.krd" target="_blank" rel="noopener noreferrer">
    Cloudflare
    </a>
  </h3>
  <span class="leading-1.3 text-2xl text-green-success">Working</span>
</div>

<div id="cf-host-status" class="cf-error-source relative w-1/3 md:w-full py-15 md:p-0 md:py-8 md:text-left md:border-solid md:border-0 md:border-b md:border-gray-400 overflow-hidden float-left md:float-none text-center">
  <div class="relative mb-10 md:m-0">

    <span class="cf-icon-server block md:hidden h-20 bg-center bg-no-repeat"></span>
    <span class="cf-icon-error w-12 h-12 absolute left-1/2 md:left-auto md:right-0 md:top-0 -ml-6 -bottom-4"></span>

  </div>
  <span class="md:block w-full truncate">gpt.pawan.krd</span>
  <h3 class="md:inline-block mt-3 md:mt-0 text-2xl text-gray-600 font-light leading-1.3">

    Host

  </h3>
  <span class="leading-1.3 text-2xl text-red-error">Error</span>
</div>

                </div>

            </div>
        </div>

        <div class="w-240 lg:w-full mx-auto mb-8 lg:px-8">
            <div class="clearfix">
                <div class="w-1/2 md:w-full float-left pr-6 md:pb-10 md:pr-0 leading-relaxed">
                    <h2 class="text-3xl font-normal leading-1.3 mb-4">What happened?</h2>
                    <p>The web server reported a gateway time-out error.</p>
                </div>

                <div class="w-1/2 md:w-full float-left leading-relaxed">
                    <h2 class="text-3xl font-normal leading-1.3 mb-4">What can I do?</h2>
                    <p class="mb-6">Please try again in a few minutes.</p>
                </div>
            </div>

        </div>

        <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
  <p class="text-13">
    <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">7ddb20f36e659e3b</strong></span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span id="cf-footer-item-ip" class="cf-footer-item hidden sm:block sm:mb-1">
      Your IP:
      <button type="button" id="cf-footer-ip-reveal" class="cf-footer-ip-reveal-btn">Click to reveal</button>
      <span class="hidden" id="cf-footer-ip">2402:800:63b8:c257:8ef3:93e8:3251:763d</span>
      <span class="cf-footer-separator sm:hidden">&bull;</span>
    </span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing?utm_source=errorcode_504&utm_campaign=gpt.pawan.krd" id="brand_link" target="_blank">Cloudflare</a></span>

  </p>
  <script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script>
</div><!-- /.error-footer -->

    </div>
</div>
</body>
</html>
acheong08 commented 1 year ago

pip show revChatGPT

phamxtien commented 1 year ago

Name: revChatGPT Version: 3.2.0 Summary: ChatGPT is a reverse engineering of OpenAI's ChatGPT API Home-page: https://github.com/acheong08/ChatGPT Author: Antonio Cheong Author-email: acheong@student.dalat.org License: GNU General Public License v2.0 Location: /home/phamxuantien/.local/lib/python3.10/site-packages Requires: httpx, OpenAIAuth, prompt-toolkit, requests, tiktoken Required-by:

acheong08 commented 1 year ago

We are on version 6.5.0

phamxtien commented 1 year ago

I install by python3 -m pip install revChatGPT

acheong08 commented 1 year ago

You problem

phamxtien commented 1 year ago

It runs smooth after python3 -m pip install --upgrade revChatGPT