From 4b4d37b332b9a73376870538755b7fa2df610060 Mon Sep 17 00:00:00 2001 From: Accusys Date: Thu, 25 Jun 2026 02:19:07 +0800 Subject: [PATCH] fix: qdrant_request empty body handling (use 'is not None' check) Fix qdrant_request() to properly handle empty dict {} as body. Python's 'if body' evaluates to False for empty dict, causing EOF error. Changed: - data = json.dumps(body).encode() if body is not None else None Also cleaned up count_seeds() to use consistent body passing. --- scripts/utils/qdrant_faces.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/utils/qdrant_faces.py b/scripts/utils/qdrant_faces.py index 37a865e..f40aad5 100644 --- a/scripts/utils/qdrant_faces.py +++ b/scripts/utils/qdrant_faces.py @@ -41,7 +41,7 @@ BATCH_SIZE = int(os.environ.get("QDRANT_BATCH_SIZE", "100")) def qdrant_request(method: str, path: str, body: dict = None) -> dict: """Make HTTP request to Qdrant""" url = f"{QDRANT_URL}{path}" - data = json.dumps(body).encode() if body else None + data = json.dumps(body).encode() if body is not None else None req = urllib.request.Request(url, data=data, method=method) req.add_header("Content-Type", "application/json") req.add_header("Api-Key", QDRANT_API_KEY) @@ -605,7 +605,7 @@ def count_seeds(source: str = None) -> int: """ ensure_seeds_collection() - body = {} # Always pass empty body for count + body = {} if source: body["filter"] = { "must": [ @@ -613,7 +613,7 @@ def count_seeds(source: str = None) -> int: ] } - result = qdrant_request("POST", f"/collections/{SEEDS_COLLECTION}/points/count", body if body else {}) + result = qdrant_request("POST", f"/collections/{SEEDS_COLLECTION}/points/count", body) return result.get("result", {}).get("count", 0)