From 1906b5fd06917f745c0a2f68c7f2897954be2bc3 Mon Sep 17 00:00:00 2001 From: razrab Date: Thu, 16 Nov 2023 12:05:53 +0300 Subject: Add back crutch of incorrect responses to ChatBase --- g4f/Provider/ChatBase.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'g4f/Provider') diff --git a/g4f/Provider/ChatBase.py b/g4f/Provider/ChatBase.py index 9f11e1ac..ccc20244 100644 --- a/g4f/Provider/ChatBase.py +++ b/g4f/Provider/ChatBase.py @@ -12,6 +12,8 @@ class ChatBase(AsyncGeneratorProvider): supports_message_history = True working = True jailbreak = True + list_incorrect_responses = ["support@chatbase", + "about Chatbase"] @classmethod async def create_async_generator( @@ -53,6 +55,9 @@ class ChatBase(AsyncGeneratorProvider): response_data = "" async for stream in response.content.iter_any(): response_data += stream.decode() + for incorrect_response in cls.list_incorrect_responses: + if incorrect_response in response_data: + raise RuntimeError("Incorrect response") yield stream.decode() @classmethod -- cgit v1.2.3