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

Error GPT 3.5 turbo Response 401: {"detail":"Unauthorized"} #1812

Open
BokDan93 opened this issue Apr 9, 2024 · 15 comments
Open

Error GPT 3.5 turbo Response 401: {"detail":"Unauthorized"} #1812

BokDan93 opened this issue Apr 9, 2024 · 15 comments
Assignees
Labels
bug Something isn't working stale

Comments

@BokDan93
Copy link

BokDan93 commented Apr 9, 2024

I added it yesterday .HAR File to the folder ./harder, the model is working, today the error Response 401: {"detail":"Unauthorized"}
What to do? Do I need to add a file every time? Is it possible to do as before and not use this file?

@BokDan93 BokDan93 added the bug Something isn't working label Apr 9, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented Apr 9, 2024

You could install and use nodriver.
It performs the same function as the previous webdriver.

@BokDan93
Copy link
Author

Could you please tell me how to do this or provide a link to the tutorial?

@hlohaus
Copy link
Collaborator

hlohaus commented Apr 10, 2024

The installation of Nodriver can be achieved through the following command:

pip install -U nodriver

No further configuration is required.

@iG8R
Copy link

iG8R commented Apr 10, 2024

Please, could you elaborate how to use nodriver to make WebUI start working instead of bringing up:

Using OpenaiChat provider and gpt-3.5-turbo model
ERROR:root:Response 401: {"detail":"Could not parse your authentication token. Please try signing in again."}
Traceback (most recent call last):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\gui\server\api.py", line 125, in _create_response_stream
    for chunk in ChatCompletion.create(**kwargs):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 208, in create_completion
    yield loop.run_until_complete(await_callback(gen.__anext__))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 40, in await_callback
    return await callback()
           ^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\Provider\needs_auth\OpenaiChat.py", line 381, in create_async_generator
    await raise_for_status(response)
  File "c:\gpt4free\venv\Lib\site-packages\g4f\requests\raise_for_status.py", line 28, in raise_for_status_async
    raise ResponseStatusError(f"Response {response.status}: {message}")
g4f.errors.ResponseStatusError: Response 401: {"detail":"Could not parse your authentication token. Please try signing in again."}
127.0.0.1 - - [10/Apr/2024 15:03:45] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [10/Apr/2024 15:03:45] "POST /backend-api/v2/conversation HTTP/1.1" 200 -

@BokDan93
Copy link
Author

Thanks, I'll try!

Could you reflect this point somewhere in the tutorials, at least where we are talking about the .har file? Thank you in advance

@iG8R
Copy link

iG8R commented Apr 10, 2024

PS. Forgot to mention that even with nodriver installed, the aforementioned error still occurs.

@hlohaus
Copy link
Collaborator

hlohaus commented Apr 10, 2024

I have resolved the authentication token parsing issue in the GUI.

Nodriver should now automatically open a browser window.

@iG8R
Copy link

iG8R commented Apr 10, 2024

Now (0.2.9.3 version) it starts work fine with the presence of the har file, but without it only arises the following error:

Using OpenaiChat provider and gpt-3.5-turbo model
127.0.0.1 - - [10/Apr/2024 18:24:50] "GET /static/img/user.png HTTP/1.1" 200 -
ERROR:root:
Traceback (most recent call last):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\gui\server\api.py", line 125, in _create_response_stream
    for chunk in ChatCompletion.create(**kwargs):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 211, in create_completion
    yield loop.run_until_complete(await_callback(gen.__anext__))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 40, in await_callback
    return await callback()
           ^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\Provider\needs_auth\OpenaiChat.py", line 371, in create_async_generator
    await cls.nodriver_access_token()
  File "c:\gpt4free\venv\Lib\site-packages\g4f\Provider\needs_auth\OpenaiChat.py", line 584, in nodriver_access_token
    browser = await uc.start(user_data_dir=user_data_dir)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\nodriver\core\util.py", line 74, in start
    return await Browser.create(config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\nodriver\core\browser.py", line 87, in create
    await instance.start()
  File "c:\gpt4free\venv\Lib\site-packages\nodriver\core\browser.py", line 312, in start
    await asyncio.create_subprocess_exec(
  File "C:\Python312\Lib\asyncio\subprocess.py", line 222, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 1708, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 502, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError
127.0.0.1 - - [10/Apr/2024 18:24:51] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [10/Apr/2024 18:24:51] "POST /backend-api/v2/conversation HTTP/1.1" 200 -

@BokDan93
Copy link
Author

Error after installation pip install -U nodriver:
list index out of range

Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Apr 19, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented Apr 23, 2024

Do you still have this error?

@github-actions github-actions bot removed the stale label Apr 24, 2024
@BokDan93
Copy link
Author

BokDan93 commented Apr 29, 2024

yes(
Uploading 2024-04-29_21h14_17.jpg…

Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label May 13, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented May 19, 2024

The validity period of an OpenAI Chat .har file is limited to one day.

@github-actions github-actions bot removed the stale label May 20, 2024
Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

4 participants