Move character slot label policy

This commit is contained in:
2026-06-27 08:21:44 +02:00
parent b3fce97efd
commit 3f251a6bb7
5 changed files with 57 additions and 23 deletions
+2 -18
View File
@@ -2432,27 +2432,11 @@ def build_character_slot_json(
def _slot_explicit_label(slot: dict[str, Any]) -> str:
label = str(slot.get("label") or "").strip().upper()
if label in CHARACTER_LABEL_CHOICES and label != "AUTO_CHAIN":
return label
return ""
return cast_context_policy.explicit_character_slot_label(slot)
def _character_slot_label_map(slots: list[dict[str, Any]]) -> dict[str, dict[str, Any]]:
label_map: dict[str, dict[str, Any]] = {}
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for subject_type, prefix in (("woman", "Woman"), ("man", "Man")):
subject_slots = [slot for slot in slots if slot.get("subject_type") == subject_type]
auto_slots = [slot for slot in subject_slots if not _slot_explicit_label(slot)]
for index, slot in enumerate(reversed(auto_slots)):
if index >= len(letters):
break
label_map[f"{prefix} {letters[index]}"] = slot
for slot in subject_slots:
explicit = _slot_explicit_label(slot)
if explicit:
label_map[f"{prefix} {explicit}"] = slot
return label_map
return cast_context_policy.character_slot_label_map(slots)
def _pov_character_labels(