Extract subject context policy

This commit is contained in:
2026-06-27 08:41:13 +02:00
parent 70a8698cbe
commit d9275f5f0c
5 changed files with 140 additions and 56 deletions
+18
View File
@@ -57,6 +57,7 @@ import sdxl_formatter # noqa: E402
import sdxl_presets # noqa: E402
import seed_config # noqa: E402
import krea_pov # noqa: E402
import subject_context # noqa: E402
Trigger = "sxcppnl7"
@@ -684,6 +685,23 @@ def smoke_category_cast_config_policy() -> None:
== ("two women", "two women", "close affectionate couple pose", 2, 0),
"Couple type count override for two women changed",
)
_expect(
pb._subject_context(random.Random(5), "couple", "any", "curvy", False, False, 1, 1)
== subject_context.subject_context(random.Random(5), "couple", "any", "curvy", False, False, 1, 1),
"Prompt builder subject context should delegate to subject_context",
)
_expect(
subject_context.subject_context(random.Random(1), "configured_cast", "any", "curvy", False, False, 2, 1).get("cast_summary")
== "2 women, 1 man, 3 total adults",
"Configured cast subject context changed",
)
group = subject_context.subject_context(random.Random(2), "group", "asian", "curvy", False, False)
_expect(group.get("subject") == "mixed Asian adult group", "Group subject ethnicity wording changed")
_expect(
subject_context.subject_context(random.Random(3), "layout", "any", "curvy", False, False).get("subject")
== "layout scene",
"Layout subject context fallback changed",
)
label_slots = [
{"subject_type": "woman", "label": "auto_chain", "name": "older auto"},
{"subject_type": "woman", "label": "auto_chain", "name": "newer auto"},