Consume formatter hints
This commit is contained in:
@@ -1225,6 +1225,11 @@ def smoke_hardcore_position_config_policy() -> None:
|
||||
_expect(formatter_hints.get("krea") == ["keep mouth contact readable"], "Template metadata route lost Krea formatter hint")
|
||||
_expect(formatter_hints.get("sdxl") == ["oral contact", "kneeling oral"], "Template metadata route lost SDXL formatter hints")
|
||||
_expect(formatter_hints.get("caption") == ["oral contact caption detail"], "Template metadata route lost caption formatter hint")
|
||||
route_hints = category_template_metadata.formatter_hints_for_route(
|
||||
{"formatter_hints": {"all": ["shared formatter cue"], "krea2": ["krea formatter cue"]}},
|
||||
"krea2",
|
||||
)
|
||||
_expect(route_hints == ["shared formatter cue", "krea formatter cue"], "Formatter hint route resolver changed")
|
||||
_expect(
|
||||
pb._template_action_family(template_metadata) == category_template_metadata.template_action_family(template_metadata),
|
||||
"Prompt builder template action policy should delegate",
|
||||
@@ -2486,6 +2491,39 @@ def smoke_formatter_metadata_fixtures() -> None:
|
||||
for term in case["caption_terms"]:
|
||||
_expect(term in caption_text, f"{name}.caption missing {term!r}")
|
||||
|
||||
route_row = _fixture_hardcore_row(
|
||||
formatter_hints={
|
||||
"all": ["shared route anchor"],
|
||||
"krea": ["krea readable anchor"],
|
||||
"sdxl": ["sdxl route tag"],
|
||||
"caption": ["caption route phrase"],
|
||||
}
|
||||
)
|
||||
_expect_custom_row(route_row, "fixture_formatter_hints")
|
||||
metadata = _json(route_row)
|
||||
|
||||
krea = krea_formatter.format_krea2_prompt("", metadata_json=metadata, target="single")
|
||||
krea_prompt = _expect_text("fixture_formatter_hints.krea_prompt", krea.get("krea_prompt"), 40).lower()
|
||||
_expect("shared route anchor" in krea_prompt, "Krea formatter missed shared formatter hint")
|
||||
_expect("krea readable anchor" in krea_prompt, "Krea formatter missed Krea formatter hint")
|
||||
_expect("sdxl route tag" not in krea_prompt, "Krea formatter leaked SDXL formatter hint")
|
||||
_expect("caption route phrase" not in krea_prompt, "Krea formatter leaked caption formatter hint")
|
||||
|
||||
sdxl = sdxl_formatter.format_sdxl_prompt("", metadata_json=metadata, target="single", trigger=SdxlTrigger, prepend_trigger=True)
|
||||
sdxl_prompt = _expect_text("fixture_formatter_hints.sdxl_prompt", sdxl.get("sdxl_prompt"), 40).lower()
|
||||
_expect("shared route anchor" in sdxl_prompt, "SDXL formatter missed shared formatter hint")
|
||||
_expect("sdxl route tag" in sdxl_prompt, "SDXL formatter missed SDXL formatter hint")
|
||||
_expect("krea readable anchor" not in sdxl_prompt, "SDXL formatter leaked Krea formatter hint")
|
||||
_expect("caption route phrase" not in sdxl_prompt, "SDXL formatter leaked caption formatter hint")
|
||||
|
||||
caption, method = caption_naturalizer.naturalize_caption("", metadata_json=metadata, trigger=Trigger, include_trigger=True)
|
||||
caption_text = _expect_text("fixture_formatter_hints.caption", caption, 40).lower()
|
||||
_expect("metadata" in method, "Caption formatter hints fixture did not use metadata")
|
||||
_expect("shared route anchor" in caption_text, "Caption naturalizer missed shared formatter hint")
|
||||
_expect("caption route phrase" in caption_text, "Caption naturalizer missed caption formatter hint")
|
||||
_expect("krea readable anchor" not in caption_text, "Caption naturalizer leaked Krea formatter hint")
|
||||
_expect("sdxl route tag" not in caption_text, "Caption naturalizer leaked SDXL formatter hint")
|
||||
|
||||
|
||||
def smoke_node_utility_registration() -> None:
|
||||
required_nodes = [
|
||||
|
||||
Reference in New Issue
Block a user