diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-12 02:06:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 02:06:06 +0100 |
commit | 6ef282de3a3245acbfecd08ae48dba85ff91d031 (patch) | |
tree | 0236c9678eea8f9c78ed7c09f3d86eaf3d7c691c /g4f/Provider/GptGo.py | |
parent | Update .gitignore (diff) | |
download | gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.gz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.bz2 gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.lz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.xz gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.tar.zst gpt4free-6ef282de3a3245acbfecd08ae48dba85ff91d031.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/not_working/GptGo.py (renamed from g4f/Provider/GptGo.py) | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/g4f/Provider/GptGo.py b/g4f/Provider/not_working/GptGo.py index 538bb7b6..363aabea 100644 --- a/g4f/Provider/GptGo.py +++ b/g4f/Provider/not_working/GptGo.py @@ -4,14 +4,14 @@ from aiohttp import ClientSession import json import base64 -from ..typing import AsyncResult, Messages -from .base_provider import AsyncGeneratorProvider, format_prompt +from ...typing import AsyncResult, Messages +from ..base_provider import AsyncGeneratorProvider, format_prompt class GptGo(AsyncGeneratorProvider): url = "https://gptgo.ai" + working = False supports_gpt_35_turbo = True - working = True @classmethod async def create_async_generator( @@ -44,6 +44,8 @@ class GptGo(AsyncGeneratorProvider): ) as response: response.raise_for_status() token = await response.text(); + if token == "error token": + raise RuntimeError(f"Response: {token}") token = base64.b64decode(token[10:-20]).decode() async with session.get( @@ -57,6 +59,8 @@ class GptGo(AsyncGeneratorProvider): break if line.startswith(b"data: "): line = json.loads(line[6:]) + if "choices" not in line: + raise RuntimeError(f"Response: {line}") content = line["choices"][0]["delta"].get("content") if content and content != "\n#GPTGO ": yield content |