Extract SDXL tag policy

This commit is contained in:
2026-06-27 11:48:54 +02:00
parent 8fc3abc504
commit 2605fae3eb
5 changed files with 325 additions and 196 deletions
+37
View File
@@ -76,6 +76,7 @@ import row_subject_route # noqa: E402
import server_routes # noqa: E402
import sdxl_formatter # noqa: E402
import sdxl_presets # noqa: E402
import sdxl_tag_policy # noqa: E402
import sdxl_tag_routes # noqa: E402
import seed_config # noqa: E402
import krea_pov # noqa: E402
@@ -2489,6 +2490,41 @@ def smoke_sdxl_presets_policy() -> None:
_expect("score_9" not in profiled_prompt, "SDXL photo profile should switch away from Pony score quality tail")
def smoke_sdxl_tag_policy() -> None:
row = _fixture_hardcore_row(
action_family="oral",
position_family="oral",
position_key="kneeling_oral",
position_keys=["kneeling_oral"],
formatter_hints={"sdxl": ["policy route tag"]},
)
_expect(
sdxl_formatter._split_tag_text("Woman A with camera, Man A")
== sdxl_tag_policy.split_tag_text("Woman A with camera, Man A"),
"SDXL formatter split helper should delegate to sdxl_tag_policy",
)
_expect(
sdxl_formatter._metadata_family_tags(row) == sdxl_tag_policy.metadata_family_tags(row),
"SDXL formatter metadata-family helper should delegate to sdxl_tag_policy",
)
_expect(
sdxl_formatter._camera_tags(row) == sdxl_tag_policy.camera_tags(row),
"SDXL formatter camera helper should delegate to sdxl_tag_policy",
)
_expect(
sdxl_formatter._combine_tags("a, b", "a", "c")
== sdxl_tag_policy.combine_tags("a, b", "a", "c")
== "a, b, c",
"SDXL tag combining changed",
)
deps = sdxl_formatter._sdxl_tag_route_dependencies()
_expect(deps.tag_key is sdxl_tag_policy.tag_key, "SDXL route deps lost policy tag_key")
_expect(deps.normal_character_tags is sdxl_tag_policy.normal_character_tags, "SDXL route deps lost character tag policy")
_expect(deps.metadata_family_tags is sdxl_tag_policy.metadata_family_tags, "SDXL route deps lost metadata family policy")
_expect(deps.camera_tags is sdxl_tag_policy.camera_tags, "SDXL route deps lost camera tag policy")
_expect(deps.explicit_tags is sdxl_tag_policy.explicit_tags, "SDXL route deps lost explicit tag policy")
def smoke_sdxl_tag_routes() -> None:
row = _fixture_hardcore_row(
formatter_hints={
@@ -5315,6 +5351,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
("caption_policy", smoke_caption_policy),
("caption_metadata_routes", smoke_caption_metadata_routes),
("sdxl_presets_policy", smoke_sdxl_presets_policy),
("sdxl_tag_policy", smoke_sdxl_tag_policy),
("sdxl_tag_routes", smoke_sdxl_tag_routes),
("hardcore_position_config_policy", smoke_hardcore_position_config_policy),
("row_route_metadata_policy", smoke_row_route_metadata_policy),