From ae8dae82cffb07eeeecc5b07ffc9b502e92bfe62 Mon Sep 17 00:00:00 2001 From: abc <98614666+xtekky@users.noreply.github.com> Date: Sat, 21 Oct 2023 00:52:19 +0100 Subject: ~ | g4f `v-0.1.7.2` patch / unpatch providers --- g4f/Provider/GptGod.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'g4f/Provider/GptGod.py') diff --git a/g4f/Provider/GptGod.py b/g4f/Provider/GptGod.py index 6c975389..060500a9 100644 --- a/g4f/Provider/GptGod.py +++ b/g4f/Provider/GptGod.py @@ -8,7 +8,7 @@ from .helper import format_prompt class GptGod(AsyncGeneratorProvider): url = "https://gptgod.site" supports_gpt_35_turbo = True - working = True + working = False @classmethod async def create_async_generator( @@ -18,6 +18,7 @@ class GptGod(AsyncGeneratorProvider): proxy: str = None, **kwargs ) -> AsyncResult: + headers = { "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/118.0", "Accept": "text/event-stream", @@ -32,6 +33,7 @@ class GptGod(AsyncGeneratorProvider): "Pragma": "no-cache", "Cache-Control": "no-cache", } + async with ClientSession(headers=headers) as session: prompt = format_prompt(messages) data = { @@ -42,6 +44,8 @@ class GptGod(AsyncGeneratorProvider): response.raise_for_status() event = None async for line in response.content: + print(line) + if line.startswith(b'event: '): event = line[7:-1] elif event == b"data" and line.startswith(b"data: "): -- cgit v1.2.3