From be2639c596bf2d651177a415e983bd23780fc392 Mon Sep 17 00:00:00 2001 From: empty Date: Wed, 7 Jan 2026 15:49:11 +0800 Subject: [PATCH] fix: Add to_dict method to CharacterMemory for JSON serialization --- pixelle_video/services/quality/character_memory.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pixelle_video/services/quality/character_memory.py b/pixelle_video/services/quality/character_memory.py index 02cd01a..900e360 100644 --- a/pixelle_video/services/quality/character_memory.py +++ b/pixelle_video/services/quality/character_memory.py @@ -558,6 +558,19 @@ class CharacterMemory: self._characters.clear() self._name_index.clear() logger.info("Character memory cleared") + + def to_dict(self) -> dict: + """Convert to JSON-serializable dictionary""" + return { + "characters": [char.to_dict() for char in self.characters], + "config": { + "auto_detect_characters": self.config.auto_detect_characters, + "use_llm_detection": self.config.use_llm_detection, + "inject_character_prompts": self.config.inject_character_prompts, + "use_reference_images": self.config.use_reference_images, + "enable_visual_features": self.config.enable_visual_features, + } + } @property def feature_extractor(self):