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

XFEstudio/gpt4free

Fix copy images

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

代码差异

2 个文件 +3 -1
Modified g4f/gui/server/backend_api.py +1 -0
@@ -260,6 +260,7 @@ class Backend_Api(Api):
260 260 buffer.get_list(),
261 261 buffer.get("cookies"),
262 262 buffer.get("headers"),
263 None,
263 264 request.args.get("prompt")
264 265 )).pop()
265 266 elif isinstance(buffer, AudioResponse):
Modified g4f/image/copy_images.py +2 -1
@@ -96,7 +96,7 @@ def get_filename(tags: list[str], alt: str, extension: str, image: str) -> str:
96 96 tags = f"{'+'.join([str(tag) for tag in tags if tag])}+" if tags else ""
97 97 return "".join((
98 98 f"{int(time.time())}_",
99 f"{secure_filename(tags + alt)}_",
99 f"{secure_filename(tags or "" + alt)}_",
100 100 hashlib.sha256(image.encode()).hexdigest()[:16],
101 101 extension
102 102 ))
@@ -151,6 +151,7 @@ async def copy_media(
151 151 request_headers = headers
152 152 request_ssl = ssl
153 153 # Use aiohttp to fetch the image
154 debug.log(f"Copying image: {image} to {target_path}")
154 155 async with session.get(image, ssl=request_ssl, headers=request_headers) as response:
155 156 response.raise_for_status()
156 157 media_type = response.headers.get("content-type", "application/octet-stream")