From 6ef282de3a3245acbfecd08ae48dba85ff91d031 Mon Sep 17 00:00:00 2001 From: H Lohaus Date: Tue, 12 Mar 2024 02:06:06 +0100 Subject: Remove all not working provider (#1679) Fix many providers Add selenium-wire to requierments --- g4f/Provider/ChatgptX.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'g4f/Provider/ChatgptX.py') 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 = { -- cgit v1.2.3