diff options
Diffstat (limited to 'g4f/Provider')
-rw-r--r-- | g4f/Provider/ChatBase.py | 15 | ||||
-rw-r--r-- | g4f/Provider/__init__.py | 9 |
2 files changed, 11 insertions, 13 deletions
diff --git a/g4f/Provider/ChatBase.py b/g4f/Provider/ChatBase.py index ce5160d8..3d45b40b 100644 --- a/g4f/Provider/ChatBase.py +++ b/g4f/Provider/ChatBase.py @@ -9,7 +9,6 @@ from .base_provider import AsyncGeneratorProvider class ChatBase(AsyncGeneratorProvider): url = "https://www.chatbase.co" supports_gpt_35_turbo = True - supports_gpt_4 = True working = True @classmethod @@ -20,12 +19,8 @@ class ChatBase(AsyncGeneratorProvider): proxy: str = None, **kwargs ) -> AsyncResult: - if model == "gpt-4": - chat_id = "quran---tafseer-saadi-pdf-wbgknt7zn" - elif model == "gpt-3.5-turbo" or not model: - chat_id = "chatbase--1--pdf-p680fxvnm" - else: - raise ValueError(f"Model are not supported: {model}") + chat_id = 'z2c2HSfKnCTh5J4650V0I' + headers = { "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36", "Accept" : "*/*", @@ -36,21 +31,19 @@ class ChatBase(AsyncGeneratorProvider): "Sec-Fetch-Mode" : "cors", "Sec-Fetch-Site" : "same-origin", } - async with ClientSession( - headers=headers - ) as session: + async with ClientSession(headers=headers) as session: data = { "messages": messages, "captchaCode": "hadsa", "chatId": chat_id, "conversationId": f"kcXpqEnqUie3dnJlsRi_O-{chat_id}" } + async with session.post("https://www.chatbase.co/api/fe/chat", json=data, proxy=proxy) as response: response.raise_for_status() async for stream in response.content.iter_any(): yield stream.decode() - @classmethod @property def params(cls): diff --git a/g4f/Provider/__init__.py b/g4f/Provider/__init__.py index 857b814d..26f523c7 100644 --- a/g4f/Provider/__init__.py +++ b/g4f/Provider/__init__.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from __future__ import annotations from .Acytoo import Acytoo from .AiAsk import AiAsk from .Aibn import Aibn @@ -99,7 +99,12 @@ class ProviderUtils: 'Wuguokai': Wuguokai, 'Ylokh': Ylokh, 'You': You, - 'Yqcloud': Yqcloud + 'Yqcloud': Yqcloud, + + 'BaseProvider': BaseProvider, + 'AsyncProvider': AsyncProvider, + 'AsyncGeneratorProvider': AsyncGeneratorProvider, + 'RetryProvider': RetryProvider, } __all__ = [ |