diff options
author | abc <98614666+xtekky@users.noreply.github.com> | 2023-10-14 15:36:24 +0200 |
---|---|---|
committer | abc <98614666+xtekky@users.noreply.github.com> | 2023-10-14 15:36:24 +0200 |
commit | 1f8293250e5fd4a76997d5b6d37711bf184d4905 (patch) | |
tree | b064fe6f8c46583f3390e6784b47e53a6f17eb08 /g4f | |
parent | g4f `v-0.1.6.3` (diff) | |
download | gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.tar gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.tar.gz gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.tar.bz2 gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.tar.lz gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.tar.xz gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.tar.zst gpt4free-1f8293250e5fd4a76997d5b6d37711bf184d4905.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/ChatBase.py | 15 | ||||
-rw-r--r-- | g4f/Provider/__init__.py | 9 | ||||
-rw-r--r-- | g4f/models.py | 2 |
3 files changed, 11 insertions, 15 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 86346851..4437f563 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__ = [ diff --git a/g4f/models.py b/g4f/models.py index 73e7e481..a0f4c429 100644 --- a/g4f/models.py +++ b/g4f/models.py @@ -10,7 +10,6 @@ from .Provider import ( Vitalentum, ChatgptAi, AItianhu, - ChatBase, Liaobots, Yqcloud, Myshell, @@ -41,7 +40,6 @@ default = Model( best_provider = RetryProvider([ Bing, # Not fully GPT 3 or 4 Yqcloud, # Answers short questions in chinese - ChatBase, # Don't want to answer creatively ChatgptDuo, # Include search results Aibn, Aichat, ChatgptAi, ChatgptLogin, FreeGpt, GptGo, Myshell, Ylokh, ]) |