diff options
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/ChatgptX.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/g4f/Provider/ChatgptX.py b/g4f/Provider/ChatgptX.py index c8b9375a..9be0d89b 100644 --- a/g4f/Provider/ChatgptX.py +++ b/g4f/Provider/ChatgptX.py @@ -7,12 +7,12 @@ from aiohttp import ClientSession from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider from .helper import format_prompt - +from ..errors import RateLimitError class ChatgptX(AsyncGeneratorProvider): url = "https://chatgptx.de" supports_gpt_35_turbo = True - working = False + working = True @classmethod async def create_async_generator( @@ -73,6 +73,8 @@ class ChatgptX(AsyncGeneratorProvider): async with session.post(f'{cls.url}/sendchat', data=data, headers=headers, proxy=proxy) as response: response.raise_for_status() chat = await response.json() + if "messages" in chat and "Anfragelimit" in chat["messages"]: + raise RateLimitError("Rate limit reached") if "response" not in chat or not chat["response"]: raise RuntimeError(f'Response: {chat}') headers = { |