diff --git a/g4f/gui/server/backend_api.py b/g4f/gui/server/backend_api.py index d5b64f29..8f07c940 100644 --- a/g4f/gui/server/backend_api.py +++ b/g4f/gui/server/backend_api.py @@ -260,6 +260,7 @@ class Backend_Api(Api): buffer.get_list(), buffer.get("cookies"), buffer.get("headers"), + None, request.args.get("prompt") )).pop() elif isinstance(buffer, AudioResponse): diff --git a/g4f/image/copy_images.py b/g4f/image/copy_images.py index 98915b4c..8a2886ad 100644 --- a/g4f/image/copy_images.py +++ b/g4f/image/copy_images.py @@ -96,7 +96,7 @@ def get_filename(tags: list[str], alt: str, extension: str, image: str) -> str: tags = f"{'+'.join([str(tag) for tag in tags if tag])}+" if tags else "" return "".join(( f"{int(time.time())}_", - f"{secure_filename(tags + alt)}_", + f"{secure_filename(tags or "" + alt)}_", hashlib.sha256(image.encode()).hexdigest()[:16], extension )) @@ -151,6 +151,7 @@ async def copy_media( request_headers = headers request_ssl = ssl # Use aiohttp to fetch the image + debug.log(f"Copying image: {image} to {target_path}") async with session.get(image, ssl=request_ssl, headers=request_headers) as response: response.raise_for_status() media_type = response.headers.get("content-type", "application/octet-stream")