返回提交历史
Modified
g4f/Provider/needs_auth/LMArenaBeta.py
+15
-5
XFEstudio/gpt4free
Fix save args
ee5e503b
代码差异
1 个文件
+15
-5
@@ -150,8 +150,13 @@ class LMArenaBeta(AsyncGeneratorProvider, ProviderModelMixin, AuthFileMixin):
150
150
cache_file = cls.get_cache_file()
151
151
args = {}
152
152
if cache_file.exists():
153
with cache_file.open("r") as f:
154
args = json.load(f)
153
try:
154
with cache_file.open("r") as f:
155
args = json.load(f)
156
except json.JSONDecodeError:
157
debug.log(f"Cache file {cache_file} is corrupted, removing it.")
158
cache_file.unlink()
159
args = {}
155
160
if not args:
156
161
return cls.models
157
162
response = curl_cffi.get(f"{cls.url}/?mode=direct", **args)
@@ -187,9 +192,14 @@ class LMArenaBeta(AsyncGeneratorProvider, ProviderModelMixin, AuthFileMixin):
187
192
prompt = get_last_user_message(messages)
188
193
cache_file = cls.get_cache_file()
189
194
args = None
190
if cache_file.exists() and cache_file.stat().st_mtime > time.time() - 60 * 30:
191
with cache_file.open("r") as f:
192
args = json.load(f)
195
if cache_file.exists():
196
try:
197
with cache_file.open("r") as f:
198
args = json.load(f)
199
except json.JSONDecodeError:
200
debug.log(f"Cache file {cache_file} is corrupted, removing it.")
201
cache_file.unlink()
202
args = None
193
203
for _ in range(2):
194
204
if args:
195
205
pass