diff --git a/dumas_h3_longvideos.py b/dumas_h3_longvideos.py index 2344f1c..2220eaa 100644 --- a/dumas_h3_longvideos.py +++ b/dumas_h3_longvideos.py @@ -4410,12 +4410,13 @@ def _matched_reference_slots(text, ref_slots): return matched -def _reference_context_for_text(text, ref_slots): +def _reference_context_for_text(text, ref_slots, include_character_wardrobe=True): parts = [] for slot_number, ref in _matched_reference_slots(text, ref_slots): label = _reference_text(ref.get("name")) or _reference_text(ref.get("id")) or f"reference {slot_number}" description = _reference_sentence(ref.get("description")) - wardrobe = _reference_sentence(ref.get("wardrobe")) + wardrobe = (_reference_sentence(ref.get("wardrobe")) + if include_character_wardrobe else "") general = _reference_sentence(ref.get("general")) facts = _reference_fact_sentence(ref, label) if ref.get("kind") == "location": @@ -6365,8 +6366,9 @@ class H3LongVideos: ) ref_slots = direct_ref_slots direct_ref_count = len(_connected_refs(direct_ref_slots)) + explicit_character_memory = (character_memory or "").strip() derived_character_memory = _reference_character_memory(ref_slots) - effective_character_memory = (character_memory or "").strip() or derived_character_memory + effective_character_memory = explicit_character_memory or derived_character_memory # A pixel budget overrides the preset's SIZE while keeping its aspect ratio, # so the dropdown chooses the shape and this chooses how big. Scaling from # the preset's own dimensions is what makes 1.00MP reproduce each native @@ -6582,7 +6584,11 @@ class H3LongVideos: count_auto=(subject_count_guard == "auto")) enriched_gens = [] for block in gens: - context = _reference_context_for_text(block, ref_slots) + context = _reference_context_for_text( + block, + ref_slots, + include_character_wardrobe=not bool(explicit_character_memory), + ) if context: block = _inject_reference_context(block, context) enriched_gens.append(block) diff --git a/tests/test_dumas_h3_longvideos.py b/tests/test_dumas_h3_longvideos.py index 77a5969..39dd474 100644 --- a/tests/test_dumas_h3_longvideos.py +++ b/tests/test_dumas_h3_longvideos.py @@ -620,6 +620,20 @@ class DumasH3LongVideosHelperTests(unittest.TestCase): self.assertIn("Persistent appearance for Mara: silver hair.", context) self.assertIn("Persistent wardrobe/style for Mara: red jacket.", context) + def test_reference_context_can_skip_character_wardrobe_when_live_memory_is_explicit(self): + refs = [ + {"kind": "character", "image": "img1", "name": "Mara", "description": "silver hair", "wardrobe": "red jacket"}, + ] + + context = self.module._reference_context_for_text( + "[Generation 1] Mara walks into the room.", + refs, + include_character_wardrobe=False, + ) + + self.assertIn("Persistent appearance for Mara: silver hair.", context) + self.assertNotIn("Persistent wardrobe/style for Mara: red jacket.", context) + def test_reference_context_injects_immediately_after_generation_label(self): block = ( "[Generation 1] Classic sitcom lighting and staging. "