diff --git a/backend/app/database/face_clusters.py b/backend/app/database/face_clusters.py index dc8c97334..b88f4db2b 100644 --- a/backend/app/database/face_clusters.py +++ b/backend/app/database/face_clusters.py @@ -1,6 +1,7 @@ import sqlite3 from typing import Optional, List, Dict, TypedDict, Union from app.config.settings import DATABASE_PATH +from app.utils.images import image_util_parse_metadata # Type definitions ClusterId = str @@ -306,12 +307,15 @@ def db_get_images_by_cluster_id( bbox = json.loads(bbox_json) + # Normalize metadata to a dict; downstream schemas expect an object + metadata_dict = image_util_parse_metadata(metadata) + images.append( { "image_id": image_id, "image_path": image_path, "thumbnail_path": thumbnail_path, - "metadata": metadata, + "metadata": metadata_dict, "face_id": face_id, "confidence": confidence, "bbox": bbox, diff --git a/backend/app/logging/setup_logging.py b/backend/app/logging/setup_logging.py index e64424654..424c0ea2c 100644 --- a/backend/app/logging/setup_logging.py +++ b/backend/app/logging/setup_logging.py @@ -235,19 +235,21 @@ def emit(self, record: logging.LogRecord) -> None: Args: record: The log record to process """ - # Get the appropriate module name - module_name = record.name - if "." in module_name: - module_name = module_name.split(".")[-1] - - # Create a message that includes the original module in the format - msg = record.getMessage() - - # Find the appropriate logger - logger = get_logger(module_name) - - # Log the message with our custom formatting - logger.log(record.levelno, f"[uvicorn] {msg}") + # Prevent infinite recursion + if getattr(record, "_in_intercept_handler", False): + return + + record._in_intercept_handler = True + + try: + # Just print directly to avoid recursion issues + msg = self.format(record) + print(msg, file=sys.stdout) + except Exception as e: + print(f"Logging error: {e}", file=sys.stderr) + finally: + if hasattr(record, "_in_intercept_handler"): + delattr(record, "_in_intercept_handler") def configure_uvicorn_logging(component_name: str) -> None: diff --git a/docs/backend/backend_python/openapi.json b/docs/backend/backend_python/openapi.json index 84caf5d37..b65874f03 100644 --- a/docs/backend/backend_python/openapi.json +++ b/docs/backend/backend_python/openapi.json @@ -2003,7 +2003,6 @@ "metadata": { "anyOf": [ { - "additionalProperties": true, "type": "object" }, {