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

XFEstudio/gpt4free

Fix code review issues: remove redundant else clause and improve initialization

Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>

b3131a3f
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
提交于

代码差异

1 个文件 +1 -3
Modified g4f/gui/server/api.py +1 -3
@@ -223,6 +223,7 @@ class Api:
223 223 yield self._format_json("preview", chunk.to_string(), urls=chunk.urls, alt=chunk.alt)
224 224 elif isinstance(chunk, MediaResponse):
225 225 media = chunk
226 image_metadata = None
226 227 if download_media or chunk.get("cookies"):
227 228 chunk.alt = format_media_prompt(kwargs.get("messages"), chunk.alt)
228 229 width, height = get_width_height(chunk.get("width"), chunk.get("height"))
@@ -240,7 +241,6 @@ class Api:
240 241 ))
241 242 options = {}
242 243 target_paths, urls = get_target_paths_and_urls(media)
243 image_metadata = None
244 244 if target_paths:
245 245 if has_pillow:
246 246 try:
@@ -268,8 +268,6 @@ class Api:
268 268 if total_size > 0:
269 269 image_metadata["file_size"] = total_size
270 270 media = ImageResponse(urls, chunk.alt, options) if isinstance(chunk, ImageResponse) else VideoResponse(media, chunk.alt)
271 else:
272 image_metadata = None
273 271 yield self._format_json("content", str(media), urls=media.urls, alt=media.alt)
274 272 # Yield usage statistics with image metadata for image responses
275 273 if image_metadata: