XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

Add back crutch of incorrect responses to ChatBase

1906b5fd
razrab <razrab@PimoLin>
提交于

代码差异

1 个文件 +5 -0
Modified g4f/Provider/ChatBase.py +5 -0
@@ -12,6 +12,8 @@ class ChatBase(AsyncGeneratorProvider):
12 12 supports_message_history = True
13 13 working = True
14 14 jailbreak = True
15 list_incorrect_responses = ["support@chatbase",
16 "about Chatbase"]
15 17
16 18 @classmethod
17 19 async def create_async_generator(
@@ -53,6 +55,9 @@ class ChatBase(AsyncGeneratorProvider):
53 55 response_data = ""
54 56 async for stream in response.content.iter_any():
55 57 response_data += stream.decode()
58 for incorrect_response in cls.list_incorrect_responses:
59 if incorrect_response in response_data:
60 raise RuntimeError("Incorrect response")
56 61 yield stream.decode()
57 62
58 63 @classmethod