From e34e0fa3f72cc8cba6c357caa806e2efdd0f3177 Mon Sep 17 00:00:00 2001 From: Koukunn_ <118247906+gamelist1990@users.noreply.github.com> Date: Fri, 5 Jul 2024 14:26:06 +0000 Subject: ChatGPT Reverse Engineering Update: Adapting to Arkose Detection Changes --- g4f/Provider/needs_auth/OpenaiChat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'g4f') diff --git a/g4f/Provider/needs_auth/OpenaiChat.py b/g4f/Provider/needs_auth/OpenaiChat.py index f40ae961..9321c24a 100644 --- a/g4f/Provider/needs_auth/OpenaiChat.py +++ b/g4f/Provider/needs_auth/OpenaiChat.py @@ -406,7 +406,12 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin): cls._update_request_args(session) await raise_for_status(response) requirements = await response.json() - need_arkose = requirements.get("arkose", {}).get("required") + text_data = json.loads(requirements.get("text", "{}")) + need_arkose = text_data.get("turnstile", {}).get("required", False) + if need_arkose: + arkose_token = text_data.get("turnstile", {}).get("dx") + else: + need_arkose = requirements.get("arkose", {}).get("required", False) chat_token = requirements["token"] if need_arkose and arkose_token is None: -- cgit v1.2.3