From ba60296677cdddb622fad71f957ecf1e442a0fca Mon Sep 17 00:00:00 2001
From: hlohaus <983577+hlohaus@users.noreply.github.com>
Date: Sat, 22 Feb 2025 13:19:52 +0100
Subject: Fix unittest, update model lists
---
g4f/tools/files.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'g4f/tools/files.py')
diff --git a/g4f/tools/files.py b/g4f/tools/files.py
index 49113133..6d6d2206 100644
--- a/g4f/tools/files.py
+++ b/g4f/tools/files.py
@@ -157,7 +157,7 @@ def get_filenames(bucket_dir: Path):
def stream_read_files(bucket_dir: Path, filenames: list, delete_files: bool = False) -> Iterator[str]:
for filename in filenames:
file_path: Path = bucket_dir / filename
- if not file_path.exists() and 0 > file_path.lstat().st_size:
+ if not file_path.exists() or file_path.lstat().st_size <= 0:
continue
extension = os.path.splitext(filename)[1][1:]
if filename.endswith(".zip"):
@@ -453,6 +453,8 @@ async def download_urls(
async for chunk in response.content.iter_chunked(4096):
if b'', f'\n'.encode()))
+ else:
+ f.write(chunk)
return filename
except (ClientError, asyncio.TimeoutError) as e:
debug.log(f"Download failed: {e.__class__.__name__}: {e}")
--
cgit v1.2.3