Centralize formatter route metadata

This commit is contained in:
2026-06-27 02:24:30 +02:00
parent 7d112c0f98
commit c0c2fb2b40
8 changed files with 115 additions and 29 deletions
+23 -1
View File
@@ -40,6 +40,7 @@ import krea_formatter # noqa: E402
import location_config # noqa: E402
import prompt_builder as pb # noqa: E402
import row_normalization # noqa: E402
import route_metadata # noqa: E402
import sdxl_formatter # noqa: E402
import sdxl_presets # noqa: E402
import seed_config # noqa: E402
@@ -1041,7 +1042,7 @@ def smoke_caption_policy() -> None:
)
row = {"action_family": "oral", "position_family": ""}
_expect(caption_policy.metadata_action_label(row) == "oral action", "Caption action-family label changed")
row = {"action_family": "oral", "position_family": "anal"}
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",
@@ -1225,6 +1226,27 @@ 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_row = {
"action_family": "penetrative",
"position_family": "Oral",
"position_keys": ["spread leg oral", "bad key"],
"position_key": "open thighs",
"formatter_hints": {"all": ["shared formatter cue"], "training_caption": ["caption formatter cue"]},
}
_expect(route_metadata.row_action_family(route_row) == "penetration", "Route metadata action normalization changed")
_expect(route_metadata.row_position_family(route_row) == "oral", "Route metadata position-family normalization changed")
_expect(
route_metadata.row_position_keys(route_row) == ["spread_leg_oral", "open_thighs"],
"Route metadata position-key normalization changed",
)
_expect(
route_metadata.row_position_keys({"position_keys": ["kneeling_oral"]}, include_unknown=True) == ["kneeling_oral"],
"Route metadata legacy position-key passthrough changed",
)
_expect(
route_metadata.row_formatter_hints(route_row, "caption") == ["shared formatter cue", "caption formatter cue"],
"Route metadata formatter hint routing changed",
)
route_hints = category_template_metadata.formatter_hints_for_route(
{"formatter_hints": {"all": ["shared formatter cue"], "krea2": ["krea formatter cue"]}},
"krea2",