XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

Fix beta lmarena provider

dfe71716
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

4 个文件 +5 -4
Modified g4f/Provider/hf_space/BlackForestLabs_Flux1Dev.py +1 -1
@@ -110,7 +110,7 @@ class BlackForestLabs_Flux1Dev(AsyncGeneratorProvider, ProviderModelMixin):
110 110 json_data['output']['error'] = json_data['output']['error'].split(" <a ")[0]
111 111 raise ResponseError(json_data['output']['error'])
112 112 if 'output' in json_data and 'data' in json_data['output']:
113 yield Reasoning(status="Finished")
113 yield Reasoning(status="")
114 114 if len(json_data['output']['data']) > 0:
115 115 yield ImageResponse(json_data['output']['data'][0]["url"], prompt)
116 116 break
Modified g4f/Provider/hf_space/DeepseekAI_JanusPro7b.py +1 -1
@@ -153,7 +153,7 @@ class DeepseekAI_JanusPro7b(AsyncGeneratorProvider, ProviderModelMixin):
153 153 json_data['output']['error'] = json_data['output']['error'].split(" <a ")[0]
154 154 raise ResponseError("Missing images input" if json_data['output']['error'] and "AttributeError" in json_data['output']['error'] else json_data['output']['error'])
155 155 if 'output' in json_data and 'data' in json_data['output']:
156 yield Reasoning(status="Finished")
156 yield Reasoning(status="")
157 157 if "image" in json_data['output']['data'][0][0]:
158 158 yield ImageResponse([image["image"]["url"] for image in json_data['output']['data'][0]], prompt)
159 159 else:
Modified g4f/Provider/needs_auth/Grok.py +1 -1
@@ -142,7 +142,7 @@ class Grok(AsyncAuthedProvider, ProviderModelMixin):
142 142 else:
143 143 if thinking_duration is not None:
144 144 thinking_duration = time.time() - thinking_duration
145 status = f"Thought for {thinking_duration:.2f}s" if thinking_duration > 1 else "Finished"
145 status = f"Thought for {thinking_duration:.2f}s" if thinking_duration > 1 else ""
146 146 thinking_duration = None
147 147 yield Reasoning(status=status)
148 148 yield token
Modified g4f/Provider/needs_auth/LMArenaBeta.py +2 -1
@@ -103,7 +103,7 @@ class LMArenaBeta(AsyncGeneratorProvider, ProviderModelMixin, AuthFileMixin):
103 103 async def callback(page):
104 104 while not await page.evaluate('document.cookie.indexOf("arena-auth-prod-v1") >= 0'):
105 105 await asyncio.sleep(1)
106 while await page.evaluate('document.querySelector(\'[href*="challenge"]\').length > 0') :
106 while not await page.evaluate('document.querySelector(\'textarea[name="text"]\')'):
107 107 await asyncio.sleep(1)
108 108 args = await get_args_from_nodriver(cls.url, proxy=proxy, callback=callback)
109 109 except (RuntimeError, FileNotFoundError) as e:
@@ -174,6 +174,7 @@ class LMArenaBeta(AsyncGeneratorProvider, ProviderModelMixin, AuthFileMixin):
174 174 chunk = json.loads(line[3:])
175 175 if chunk == "hasArenaError":
176 176 raise ModelNotFoundError("LMArena Beta encountered an error: hasArenaError")
177 yield chunk
177 178 elif line.startswith("a2:"):
178 179 yield ImageResponse([image.get("image") for image in json.loads(line[3:])], prompt)
179 180 elif line.startswith("ad:"):