返回提交历史
Modified
g4f/Provider/ARTA.py
+1
-1
Modified
g4f/Provider/Blackbox.py
+1
-1
Modified
g4f/Provider/ImageLabs.py
+1
-1
Modified
g4f/Provider/Websim.py
+1
-1
Modified
g4f/Provider/hf_space/Voodoohop_Flux1Schnell.py
+1
-1
Modified
g4f/Provider/needs_auth/Grok.py
+1
-2
Modified
g4f/Provider/not_working/AiChats.py
+1
-1
Modified
g4f/Provider/not_working/Airforce.py
+1
-1
Modified
g4f/cookies.py
+1
-1
Modified
g4f/gui/client/static/css/style.css
+1
-0
XFEstudio/gpt4free
Fix using ImageResponse
6a4dc74b
代码差异
10 个文件
+10
-10
@@ -187,7 +187,7 @@ class ARTA(AsyncGeneratorProvider, ProviderModelMixin):
187
187
image_urls = [image["url"] for image in status_data.get("response", [])]
188
188
duration = time.time() - start_time
189
189
yield Reasoning(label="Generated", status=f"{n} image(s) in {duration:.2f}s")
190
yield ImageResponse(images=image_urls, alt=prompt)
190
yield ImageResponse(urls=image_urls, alt=prompt)
191
191
return
192
192
elif status in ("IN_QUEUE", "IN_PROGRESS"):
193
193
if last_status != status:
@@ -639,7 +639,7 @@ class Blackbox(AsyncGeneratorProvider, ProviderModelMixin):
639
639
image_url_match = re.search(r'!\[.*?\]\((.*?)\)', full_response_text)
640
640
if image_url_match:
641
641
image_url = image_url_match.group(1)
642
yield ImageResponse(images=[image_url], alt=format_image_prompt(messages, prompt))
642
yield ImageResponse(urls=[image_url], alt=format_image_prompt(messages, prompt))
643
643
return
644
644
645
645
# Handle conversation history once, in one place
@@ -78,7 +78,7 @@ class ImageLabs(AsyncGeneratorProvider, ProviderModelMixin):
78
78
if progress_data.get('status') == 'Done' or progress_data.get('final_image_url'):
79
79
# Yield ImageResponse with the final image URL
80
80
yield ImageResponse(
81
images=[progress_data.get('final_image_url')],
81
urls=[progress_data.get('final_image_url')],
82
82
alt=prompt
83
83
)
84
84
break
@@ -124,7 +124,7 @@ class Websim(AsyncGeneratorProvider, ProviderModelMixin):
124
124
response_json = json.loads(response_text)
125
125
image_url = response_json.get("url")
126
126
if image_url:
127
yield ImageResponse(images=[image_url], alt=used_prompt)
127
yield ImageResponse(urls=[image_url], alt=used_prompt)
128
128
129
129
@classmethod
130
130
async def _handle_chat_request(
@@ -71,5 +71,5 @@ class Voodoohop_Flux1Schnell(AsyncGeneratorProvider, ProviderModelMixin):
71
71
elif event_type == b'complete':
72
72
json_data = json.loads(data)
73
73
image_url = json_data[0]['url']
74
yield ImageResponse(images=[image_url], alt=prompt)
74
yield ImageResponse(urls=[image_url], alt=prompt)
75
75
return
@@ -83,7 +83,6 @@ class Grok(AsyncAuthedProvider, ProviderModelMixin):
83
83
model: str,
84
84
messages: Messages,
85
85
auth_result: AuthResult,
86
cookies: Cookies = None,
87
86
return_conversation: bool = False,
88
87
conversation: Conversation = None,
89
88
**kwargs
@@ -130,7 +129,7 @@ class Grok(AsyncAuthedProvider, ProviderModelMixin):
130
129
yield token
131
130
generated_images = response_data.get("modelResponse", {}).get("generatedImageUrls", None)
132
131
if generated_images:
133
yield ImageResponse([f'{cls.assets_url}/{image}' for image in generated_images], "", {"cookies": cookies, "headers": headers})
132
yield ImageResponse([f'{cls.assets_url}/{image}' for image in generated_images], "", {"cookies": auth_result.cookies, "headers": auth_result.headers})
134
133
title = result.get("title", {}).get("newTitle", "")
135
134
if title:
136
135
yield TitleGeneration(title)
@@ -74,7 +74,7 @@ class AiChats(AsyncGeneratorProvider, ProviderModelMixin):
74
74
75
75
base64_image = base64.b64encode(image_data).decode('utf-8')
76
76
base64_url = f"data:image/png;base64,{base64_image}"
77
yield ImageResponse(base64_url, prompt)
77
yield ImageResponse(image_url, prompt)
78
78
else:
79
79
yield f"Error: No image URL found in the response. Full response: {response_json}"
80
80
else:
@@ -170,7 +170,7 @@ class Airforce(AsyncGeneratorProvider, ProviderModelMixin):
170
170
async with session.get(cls.api_endpoint_imagine2, params=params, proxy=proxy) as response:
171
171
if response.status == 200:
172
172
image_url = str(response.url)
173
yield ImageResponse(images=image_url, alt=prompt)
173
yield ImageResponse(urls=image_url, alt=prompt)
174
174
else:
175
175
error_text = await response.text()
176
176
raise RuntimeError(f"Image generation failed: {response.status} - {error_text}")
@@ -77,7 +77,7 @@ def get_cookies(domain_name: str, raise_requirements_error: bool = True, single_
77
77
Returns:
78
78
Dict[str, str]: A dictionary of cookie names and values.
79
79
"""
80
if cache_result and domain_name in CookiesConfig.cookies:
80
if domain_name in CookiesConfig.cookies:
81
81
return CookiesConfig.cookies[domain_name]
82
82
83
83
cookies = load_cookies_from_browsers(domain_name, raise_requirements_error, single_browser)
@@ -1316,6 +1316,7 @@ form textarea {
1316
1316
1317
1317
.field a {
1318
1318
text-wrap: nowrap;
1319
padding: 4px;
1319
1320
}
1320
1321
1321
1322
.field .fa-xmark {