Normalize built-in row scene metadata
This commit is contained in:
@@ -575,13 +575,24 @@ def smoke_builtin_single() -> None:
|
||||
_expect(row.get("subject_phrase") == "woman", "builtin single row lost normalized subject_phrase")
|
||||
_expect(row.get("women_count") == 1 and row.get("men_count") == 0, "builtin single row lost normalized cast counts")
|
||||
_expect(row.get("person_count") == 1, "builtin single row lost normalized person count")
|
||||
_expect_text("builtin_single_woman.scene_text", row.get("scene_text"), 12)
|
||||
_expect(row.get("scene_slug") == row.get("scene"), "builtin single row lost legacy scene slug metadata")
|
||||
_expect(row.get("scene_entry", {}).get("slug") == row.get("scene"), "builtin single row lost scene_entry slug")
|
||||
_expect("cast_summary" not in row, "builtin single row should not masquerade as configured cast")
|
||||
_expect_trigger_once("builtin_single_woman.prompt", row.get("prompt"), Trigger)
|
||||
krea = krea_formatter.format_krea2_prompt("", metadata_json=_json(row), target="single")
|
||||
_expect(row.get("scene_text") in str(krea.get("krea_prompt", "")), "builtin single Krea route used scene slug instead of scene text")
|
||||
sdxl = sdxl_formatter.format_sdxl_prompt("", metadata_json=_json(row), target="single", trigger=SdxlTrigger, prepend_trigger=True)
|
||||
_expect("1woman" in str(sdxl.get("sdxl_prompt", "")).lower(), "builtin single SDXL route lost normalized woman count")
|
||||
sdxl_scene_text = str(sdxl.get("sdxl_prompt", "")).lower()
|
||||
scene_words = re.findall(r"[a-z0-9]+", str(row.get("scene_text", "")).split(",", 1)[0].lower())
|
||||
scene_anchor = " ".join(scene_words[:2])
|
||||
_expect(scene_anchor in sdxl_scene_text, "builtin single SDXL route lost readable scene text")
|
||||
_expect(str(row.get("scene_slug", "")).lower() not in sdxl_scene_text, "builtin single SDXL route leaked raw scene slug")
|
||||
caption, caption_method = caption_naturalizer.naturalize_caption("", metadata_json=_json(row), target="single", trigger=Trigger, include_trigger=True)
|
||||
_expect(caption_method.endswith("metadata(single)"), "builtin single caption route did not use single metadata branch")
|
||||
_expect("woman" in caption.lower(), "builtin single caption route lost normalized subject")
|
||||
_expect(row.get("scene_text") in caption, "builtin single caption route used scene slug instead of scene text")
|
||||
_expect_formatter_outputs(row, "builtin_single_woman", target="single")
|
||||
|
||||
|
||||
@@ -2814,6 +2825,7 @@ def smoke_row_normalization_policy() -> None:
|
||||
{
|
||||
"source": "built_in_generator",
|
||||
"primary_subject": "two women",
|
||||
"scene": "office",
|
||||
"prompt": "Two adults in a clean legacy prompt.",
|
||||
"caption": "legacy couple caption",
|
||||
"negative_prompt": "bad anatomy",
|
||||
@@ -2824,6 +2836,9 @@ def smoke_row_normalization_policy() -> None:
|
||||
_expect(legacy_couple.get("subject_type") == "couple", "Legacy couple row lost normalized subject_type")
|
||||
_expect(legacy_couple.get("women_count") == 2 and legacy_couple.get("men_count") == 0, "Legacy couple row lost normalized counts")
|
||||
_expect(legacy_couple.get("person_count") == 2, "Legacy couple row lost normalized person count")
|
||||
_expect(legacy_couple.get("scene_slug") == "office", "Legacy couple row lost scene slug")
|
||||
_expect("cozy office desk" in str(legacy_couple.get("scene_text", "")), "Legacy couple row lost readable scene text")
|
||||
_expect(legacy_couple.get("scene_entry", {}).get("slug") == "office", "Legacy couple row lost scene entry")
|
||||
_expect("cast_summary" not in legacy_couple, "Legacy couple row should not gain configured-cast summary")
|
||||
|
||||
legacy_group = row_normalization.normalize_prompt_row(
|
||||
|
||||
Reference in New Issue
Block a user