Fix tagged ref character context
This commit is contained in:
@@ -4226,10 +4226,11 @@ def _slot_refs_for_text(text, ref_slots):
|
||||
for slot_number in picture_tags(text):
|
||||
if not (1 <= slot_number <= len(ref_slots or [])):
|
||||
continue
|
||||
ref = ref_slots[slot_number - 1]
|
||||
raw = ref_slots[slot_number - 1]
|
||||
ref = _reference_slot(raw, slot_number)
|
||||
if _reference_image(ref) is None:
|
||||
continue
|
||||
refs.append((slot_number, _reference_slot(ref, slot_number)))
|
||||
refs.append((slot_number, ref))
|
||||
return refs
|
||||
|
||||
|
||||
|
||||
@@ -301,6 +301,19 @@ class DumasH3LongVideosHelperTests(unittest.TestCase):
|
||||
self.assertIn("Persistent wardrobe/style for Mara: red jacket.", context)
|
||||
self.assertIn("Location context for Hangar: wet concrete floor.", context)
|
||||
|
||||
def test_reference_context_matches_tagged_character_without_name_in_text(self):
|
||||
refs = [
|
||||
{"kind": "character", "image": "img1", "name": "Mara", "description": "silver hair", "wardrobe": "red jacket"},
|
||||
]
|
||||
|
||||
context = self.module._reference_context_for_text(
|
||||
"[Generation 1] <Picture 1> walks into the room.",
|
||||
refs,
|
||||
)
|
||||
|
||||
self.assertIn("Persistent appearance for Mara: silver hair.", context)
|
||||
self.assertIn("Persistent wardrobe/style for Mara: red jacket.", context)
|
||||
|
||||
def test_reference_character_memory_uses_character_wardrobe_only(self):
|
||||
refs = [
|
||||
{"kind": "character", "image": "img1", "name": "Mara", "wardrobe": "red jacket, black boots"},
|
||||
|
||||
Reference in New Issue
Block a user