Honor softcore clothing restore for atlas prompts

This commit is contained in:
2026-07-01 00:31:58 +02:00
parent c95bb30a22
commit b7381b9d51
3 changed files with 70 additions and 9 deletions
+19 -6
View File
@@ -97,6 +97,16 @@ def _has_krea2_atlas_variant(row: dict[str, Any]) -> bool:
return any(krea2_pose_variant_catalog.get_variant(key) for key in _krea2_variant_keys(row))
def _restores_krea2_prompt_axis(row: dict[str, Any], axis_name: str) -> bool:
config = row.get("hardcore_position_config") if isinstance(row.get("hardcore_position_config"), dict) else {}
axis_values = row.get("item_axis_values") if isinstance(row.get("item_axis_values"), dict) else {}
restored_axes = [
*_list_values(config.get("restore_prompt_axes")),
*_list_values(axis_values.get("restored_prompt_axes")),
]
return axis_name in restored_axes
def _has_krea2_top_down_variant(row: dict[str, Any]) -> bool:
for key in _krea2_variant_keys(row):
variant = krea2_pose_variant_catalog.get_variant(key)
@@ -214,6 +224,14 @@ def format_insta_pair_result(request: KreaPairFormatRequest, deps: KreaPairForma
)
hard_has_atlas_variant = _has_krea2_atlas_variant(hard)
hard_output_composition = "" if hard_has_atlas_variant else deps.pov_composition_text(hard_composition, pov_labels)
hard_restores_clothing = hard_has_atlas_variant and _restores_krea2_prompt_axis(hard, "clothing_detail")
hard_clothing = deps.natural_label_text(
deps.filter_pov_labeled_clauses(
deps.natural_clothing_state(row.get("hardcore_clothing_state"), hard_action),
pov_labels,
),
hard_labels,
)
same_soft_cast = options.get("softcore_cast") == "same_as_hardcore"
soft_output_composition = deps.pov_composition_text(soft.get("composition"), pov_labels if same_soft_cast else [])
soft_cast_presence = deps.softcore_cast_presence_phrase(
@@ -284,12 +302,7 @@ def format_insta_pair_result(request: KreaPairFormatRequest, deps: KreaPairForma
hard_cast_prose,
hard_action,
deps.pov_camera_phrase(pov_labels),
""
if hard_has_atlas_variant
else deps.natural_label_text(
deps.filter_pov_labeled_clauses(deps.natural_clothing_state(row.get("hardcore_clothing_state"), hard_action), pov_labels),
hard_labels,
),
hard_clothing if (not hard_has_atlas_variant or hard_restores_clothing) else "",
f"set in {hard_scene}" if hard_scene else "",
hard_camera_scene,
deps.expression_phrase(hard_expression),