mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-09-12 08:29:30 -04:00
Merge pull request #1258 from AndPim4912/chatbase
Add back crutch of incorrect responses to ChatBase
This commit is contained in:
commit
6a793e782c
@ -12,6 +12,8 @@ class ChatBase(AsyncGeneratorProvider):
|
|||||||
supports_message_history = True
|
supports_message_history = True
|
||||||
working = True
|
working = True
|
||||||
jailbreak = True
|
jailbreak = True
|
||||||
|
list_incorrect_responses = ["support@chatbase",
|
||||||
|
"about Chatbase"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def create_async_generator(
|
async def create_async_generator(
|
||||||
@ -53,6 +55,9 @@ class ChatBase(AsyncGeneratorProvider):
|
|||||||
response_data = ""
|
response_data = ""
|
||||||
async for stream in response.content.iter_any():
|
async for stream in response.content.iter_any():
|
||||||
response_data += stream.decode()
|
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()
|
yield stream.decode()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user