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

UnexpectedResponseError #27

Open
iamsky13 opened this issue Feb 4, 2024 · 15 comments
Open

UnexpectedResponseError #27

iamsky13 opened this issue Feb 4, 2024 · 15 comments

Comments

@iamsky13
Copy link

iamsky13 commented Feb 4, 2024

I started playing with basic examples and failed to run it

Exception has occurred: UnexpectedResponseError
An unexpected error occurred. Error message: 'NoneType' object is not subscriptable.
This is what the server returned: {"wss_url":"wss://chatgpt-async-webps-prod-eastus-23.webpubsub.azure.com/client/hubs/conversations?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2NoYXRncHQtYXN5bmMtd2VicHMtcHJvZC1lYXN0dXMtMjMud2VicHVic3ViLmF6dXJlLmNvbS9jbGllbnQvaHVicy9jb252ZXJzYXRpb25zIiwiaWF0IjoxNzA3MDE1MDU4LCJleHAiOjE3MDcwMTg2NTgsInN1YiI6InVzZXItajE2a2RQSDFhS3ZQTWlnRjNzWGJlcTZpIn0.3_Gnx9QoHBqwY6v44jcuUiiPczggQrLIyt2om001GQI","expires_at":"2024-02-04T03:50:58.264613+00:00","conversation_id":"cb1ff950-ce37-47e6-a877-fc43f1a79514","response_id":"84ff9bef7c174d1e-BOS"}.
  File "D:\reverse-engineered-chatgpt-3.0.1\reverse-engineered-chatgpt-3.0.1\examples\async_basic_example.py", line 28, in main
    async for message_chunk in conversation.chat(prompt):
  File "D:\reverse-engineered-chatgpt-3.0.1\reverse-engineered-chatgpt-3.0.1\examples\async_basic_example.py", line 34, in <module>
    asyncio.run(main())
re_gpt.errors.UnexpectedResponseError: An unexpected error occurred. Error message: 'NoneType' object is not subscriptable.
This is what the server returned: {"wss_url":"wss://chatgpt-async-webps-prod-eastus-23.webpubsub.azure.com/client/hubs/conversations?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2NoYXRncHQtYXN5bmMtd2VicHMtcHJvZC1lYXN0dXMtMjMud2VicHVic3ViLmF6dXJlLmNvbS9jbGllbnQvaHVicy9jb252ZXJzYXRpb25zIiwiaWF0IjoxNzA3MDE1MDU4LCJleHAiOjE3MDcwMTg2NTgsInN1YiI6InVzZXItajE2a2RQSDFhS3ZQTWlnRjNzWGJlcTZpIn0.3_Gnx9QoHBqwY6v44jcuUiiPczggQrLIyt2om001GQI","expires_at":"2024-02-04T03:50:58.264613+00:00","conversation_id":"cb1ff950-ce37-47e6-a877-fc43f1a79514","response_id":"84ff9bef7c174d1e-BOS"}.

image

@iamsky13 iamsky13 changed the title UnexptedResponseError UnexpectedResponseError Feb 4, 2024
@waheedullahkhan001
Copy link

waheedullahkhan001 commented Feb 10, 2024

Same. I am using async variant inside discord bot. It was working fine yesterday.

@gerkim62
Copy link

This issue is that chatgpt has changed how they handle messages. they are using wss instead. someone can please update this library so it can handle wss web scokets. my python skills are limited i would have done it.

@LastTherapy
Copy link

Same promlem

@Zai-Kun
Copy link
Owner

Zai-Kun commented Mar 7, 2024

This issue is that chatgpt has changed how they handle messages. they are using wss instead. someone can please update this library so it can handle wss web scokets. my python skills are limited i would have done it.

As you said, ChatGPT changed their backend infrastructure, now they are using websockets. But it seems like this change has only been made in some regions because for some people the re_gpt is still working (including me). And after monitoring ChatGPT's network traffic in my browser, no ebsocket connection was made, it's using the method it was using before. Thus, I can't debug this until the new changes have been applied in my region too.

@gerkim62
Copy link

still not working

@LuciferM242
Copy link

not working for me eather

@waheedullahkhan001
Copy link

waheedullahkhan001 commented Mar 24, 2024

FYI

After I saw the latest PR merged ( #33 ), I tried pulling the source code and installing using setup install but still:

Traceback (most recent call last):
  File "C:\Users\Admin\PycharmProjects\playground\main.py", line 27, in <module>
    asyncio.run(main())
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Admin\PycharmProjects\playground\main.py", line 22, in main
    async for message in conversation.chat(prompt):
  File "C:\Users\Admin\PycharmProjects\playground\.venv\Lib\site-packages\re_gpt-3.0.2-py3.12.egg\re_gpt\async_chatgpt.py", line 142, in chat
    raise UnexpectedResponseError(error, server_response)
re_gpt.errors.UnexpectedResponseError: An unexpected error occurred. Error message: 'NoneType' object is not subscriptable.
This is what the server returned: {"detail":"There was a problem with your chat request. Please use a different browser or try again later."}.

@Barrierml
Copy link
Contributor

FYI

After I saw the latest PR merged ( #33 ), I tried pulling the source code and installing using setup install but still:

Traceback (most recent call last):
  File "C:\Users\Admin\PycharmProjects\playground\main.py", line 27, in <module>
    asyncio.run(main())
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Admin\PycharmProjects\playground\main.py", line 22, in main
    async for message in conversation.chat(prompt):
  File "C:\Users\Admin\PycharmProjects\playground\.venv\Lib\site-packages\re_gpt-3.0.2-py3.12.egg\re_gpt\async_chatgpt.py", line 142, in chat
    raise UnexpectedResponseError(error, server_response)
re_gpt.errors.UnexpectedResponseError: An unexpected error occurred. Error message: 'NoneType' object is not subscriptable.
This is what the server returned: {"detail":"There was a problem with your chat request. Please use a different browser or try again later."}.

PR alreay pushed, wait approved, you can use it at https://github.com/Barrierml/reverse-engineered-chatgpt

@MahdeenSky
Copy link

still same problem

@Barrierml
Copy link
Contributor

Barrierml commented Apr 2, 2024

still same problem

Can you provide a return value for this API use your chatgpt account?
https://chat.openai.com/backend-api/sentinel/chat-requirements

@MahdeenSky
Copy link

MahdeenSky commented Apr 2, 2024

still same problem

Can you provide a return value for this API use your chatgpt account? https://chat.openai.com/backend-api/sentinel/chat-requirements

detail" : "Method Not Allowed"

@gerkim62
Copy link

gerkim62 commented Apr 2, 2024

still same problem

Can you provide a return value for this API use your chatgpt account? https://chat.openai.com/backend-api/sentinel/chat-requirements

using get or post?

@MahdeenSky
Copy link

still same problem

Can you provide a return value for this API use your chatgpt account? https://chat.openai.com/backend-api/sentinel/chat-requirements

using get or post?

get

@waheedullahkhan001
Copy link

waheedullahkhan001 commented Apr 3, 2024

I found the request in network tab when loading ChatGPT:

{
"persona": "chatgpt-freeaccount",
"arkose": {
"required": false,
"dx": null
},
"turnstile": {
"required": false
},
"token": "MY TOKEN"
}

@phamxtien
Copy link

phamxtien commented Apr 4, 2024

I use
pip install -I curl_cffi==0.6.0b7
and it runs ok
and if still error try to fix sync_chatgpt.py
image

image

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

9 participants