返回提交历史
Modified
g4f/Provider/ChatBase.py
+4
-11
Modified
g4f/Provider/__init__.py
+7
-2
Modified
g4f/models.py
+0
-2
XFEstudio/gpt4free
~
fix chatbase (bad) and remove from auto selection
1f829325
代码差异
3 个文件
+11
-15
@@ -9,7 +9,6 @@ from .base_provider import AsyncGeneratorProvider
9
9
class ChatBase(AsyncGeneratorProvider):
10
10
url = "https://www.chatbase.co"
11
11
supports_gpt_35_turbo = True
12
supports_gpt_4 = True
13
12
working = True
14
13
15
14
@classmethod
@@ -20,12 +19,8 @@ class ChatBase(AsyncGeneratorProvider):
20
19
proxy: str = None,
21
20
**kwargs
22
21
) -> AsyncResult:
23
if model == "gpt-4":
24
chat_id = "quran---tafseer-saadi-pdf-wbgknt7zn"
25
elif model == "gpt-3.5-turbo" or not model:
26
chat_id = "chatbase--1--pdf-p680fxvnm"
27
else:
28
raise ValueError(f"Model are not supported: {model}")
22
chat_id = 'z2c2HSfKnCTh5J4650V0I'
23
29
24
headers = {
30
25
"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",
31
26
"Accept" : "*/*",
@@ -36,21 +31,19 @@ class ChatBase(AsyncGeneratorProvider):
36
31
"Sec-Fetch-Mode" : "cors",
37
32
"Sec-Fetch-Site" : "same-origin",
38
33
}
39
async with ClientSession(
40
headers=headers
41
) as session:
34
async with ClientSession(headers=headers) as session:
42
35
data = {
43
36
"messages": messages,
44
37
"captchaCode": "hadsa",
45
38
"chatId": chat_id,
46
39
"conversationId": f"kcXpqEnqUie3dnJlsRi_O-{chat_id}"
47
40
}
41
48
42
async with session.post("https://www.chatbase.co/api/fe/chat", json=data, proxy=proxy) as response:
49
43
response.raise_for_status()
50
44
async for stream in response.content.iter_any():
51
45
yield stream.decode()
52
46
53
54
47
@classmethod
55
48
@property
56
49
def params(cls):
@@ -1,4 +1,4 @@
1
from __future__ import annotations
1
from __future__ import annotations
2
2
from .Acytoo import Acytoo
3
3
from .AiAsk import AiAsk
4
4
from .Aibn import Aibn
@@ -99,7 +99,12 @@ class ProviderUtils:
99
99
'Wuguokai': Wuguokai,
100
100
'Ylokh': Ylokh,
101
101
'You': You,
102
'Yqcloud': Yqcloud
102
'Yqcloud': Yqcloud,
103
104
'BaseProvider': BaseProvider,
105
'AsyncProvider': AsyncProvider,
106
'AsyncGeneratorProvider': AsyncGeneratorProvider,
107
'RetryProvider': RetryProvider,
103
108
}
104
109
105
110
__all__ = [
@@ -10,7 +10,6 @@ from .Provider import (
10
10
Vitalentum,
11
11
ChatgptAi,
12
12
AItianhu,
13
ChatBase,
14
13
Liaobots,
15
14
Yqcloud,
16
15
Myshell,
@@ -41,7 +40,6 @@ default = Model(
41
40
best_provider = RetryProvider([
42
41
Bing, # Not fully GPT 3 or 4
43
42
Yqcloud, # Answers short questions in chinese
44
ChatBase, # Don't want to answer creatively
45
43
ChatgptDuo, # Include search results
46
44
Aibn, Aichat, ChatgptAi, ChatgptLogin, FreeGpt, GptGo, Myshell, Ylokh,
47
45
])