返回提交历史
Modified
g4f/Provider/Providers/Ails.py
+5
-3
XFEstudio/gpt4free
Update Ails.py
after they update the client-v version the page is not working anymore, so I made this to get the version number automatically, this way we don't need to update the version manually.
d6e65fb8
代码差异
1 个文件
+5
-3
@@ -37,7 +37,9 @@ class Utils:
37
37
n = e % 10
38
38
r = n + 1 if n % 2 == 0 else n
39
39
return str(e - n + r)
40
40
def getV():
41
crossref = requests.get("https://ai.ls"+ requests.get("https://ai.ls/?chat=1").text.split('crossorigin href="')[1].split('"')[0]).text.split('G4="')[1].split('"')[0]
42
return crossref
41
43
42
44
def _create_completion(model: str, messages: list, temperature: float = 0.6, stream: bool = False, **kwargs):
43
45
@@ -47,7 +49,7 @@ def _create_completion(model: str, messages: list, temperature: float = 0.6, str
47
49
'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
48
50
'authorization': 'Bearer free',
49
51
'client-id': str(uuid.uuid4()),
50
'client-v': '0.1.249',
52
'client-v': Utils.getV(),
51
53
'content-type': 'application/json',
52
54
'origin': 'https://ai.ls',
53
55
'referer': 'https://ai.ls/',
@@ -90,4 +92,4 @@ def _create_completion(model: str, messages: list, temperature: float = 0.6, str
90
92
yield token
91
93
92
94
params = f'g4f.Providers.{os.path.basename(__file__)[:-3]} supports: ' + \
93
'(%s)' % ', '.join([f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])
95
'(%s)' % ', '.join([f"{name}: {get_type_hints(_create_completion)[name].__name__}" for name in _create_completion.__code__.co_varnames[:_create_completion.__code__.co_argcount]])