Add caption naturalizer profiles
This commit is contained in:
@@ -969,6 +969,31 @@ def smoke_caption_policy() -> None:
|
||||
_expect(caption_policy.keep_style_terms("keep_style_terms") is True, "Caption style policy keep flag changed")
|
||||
_expect(caption_policy.detail_allows("concise") is False, "Caption concise detail gate changed")
|
||||
_expect(caption_policy.detail_allows("dense", dense_only=True) is True, "Caption dense-only gate changed")
|
||||
_expect("training_concise" in caption_policy.caption_profile_choices(), "Caption profile choices lost training_concise")
|
||||
_expect(
|
||||
caption_policy.normalize_caption_profile("bad") == caption_policy.CAPTION_PROFILE_DEFAULT,
|
||||
"Caption invalid profile fallback changed",
|
||||
)
|
||||
_expect(
|
||||
caption_policy.apply_caption_profile(
|
||||
"training_dense",
|
||||
detail_level="concise",
|
||||
style_policy="keep_style_terms",
|
||||
include_trigger=False,
|
||||
)
|
||||
== ("dense", "drop_style_tail", True),
|
||||
"Caption training_dense profile overrides changed",
|
||||
)
|
||||
_expect(
|
||||
caption_policy.apply_caption_profile(
|
||||
"manual_controls",
|
||||
detail_level="concise",
|
||||
style_policy="keep_style_terms",
|
||||
include_trigger=False,
|
||||
)
|
||||
== ("concise", "keep_style_terms", False),
|
||||
"Caption manual profile should preserve explicit controls",
|
||||
)
|
||||
|
||||
style_tail = caption_policy.STYLE_TAILS[0]
|
||||
_expect(
|
||||
@@ -991,6 +1016,13 @@ def smoke_caption_policy() -> None:
|
||||
_expect(caption_policy.metadata_action_label(row) == "oral action", "Caption action-family label changed")
|
||||
row = {"action_family": "oral", "position_family": "anal"}
|
||||
_expect(caption_naturalizer._metadata_action_label(row) == "anal action", "Caption position-family label priority changed")
|
||||
browsing_caption, browsing_method = caption_naturalizer.naturalize_caption(
|
||||
"woman, red dress, studio",
|
||||
caption_profile="browsing",
|
||||
include_trigger=True,
|
||||
)
|
||||
_expect(not browsing_caption.startswith(Trigger), "Caption browsing profile should disable trigger by default")
|
||||
_expect(browsing_method == "text(fallback)", "Caption browsing profile changed fallback method")
|
||||
|
||||
|
||||
def smoke_sdxl_presets_policy() -> None:
|
||||
@@ -2763,6 +2795,7 @@ def smoke_node_formatter_registration() -> None:
|
||||
caption, caption_method = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPCaptionNaturalizer"]().build(
|
||||
"A woman standing by a window, best quality",
|
||||
"caption_or_prompt",
|
||||
"manual_controls",
|
||||
"concise",
|
||||
"drop_style_tail",
|
||||
"sxcppnl7",
|
||||
@@ -2771,6 +2804,9 @@ def smoke_node_formatter_registration() -> None:
|
||||
_expect_text("node_formatter.caption", caption, 20)
|
||||
_expect(caption.startswith("sxcppnl7"), "Caption Naturalizer did not prepend trigger")
|
||||
_expect("text(" in caption_method, "Caption Naturalizer method changed unexpectedly")
|
||||
caption_inputs = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPCaptionNaturalizer"].INPUT_TYPES().get("required") or {}
|
||||
_expect("caption_profile" in caption_inputs, "Caption Naturalizer lost caption_profile input")
|
||||
_expect("tooltip" in caption_inputs["caption_profile"][1], "Caption profile tooltip injection missing")
|
||||
|
||||
krea_output = krea_node().build(
|
||||
"sxcppnl7 A woman standing by a window",
|
||||
|
||||
Reference in New Issue
Block a user