Tighten Krea2 POV selector formatting
This commit is contained in:
+10
-14
@@ -131,17 +131,6 @@ def _merge_variant_metadata(config_json, variants):
|
||||
existing_statuses = config.get("krea2_variant_statuses") if isinstance(config.get("krea2_variant_statuses"), dict) else {}
|
||||
config["krea2_variant_statuses"] = {**existing_statuses, **selected_statuses}
|
||||
|
||||
prompt_cues = _unique_extend(
|
||||
[*(config.get("krea2_prompt_cues") or []), *(_join_variant_cues(variants, "prompt_cues").split("; ") if variants else [])]
|
||||
)
|
||||
avoid_cues = _unique_extend(
|
||||
[*(config.get("krea2_avoid_cues") or []), *(_join_variant_cues(variants, "avoid_cues").split("; ") if variants else [])]
|
||||
)
|
||||
if prompt_cues:
|
||||
config["krea2_prompt_cues"] = prompt_cues
|
||||
if avoid_cues:
|
||||
config["krea2_avoid_cues"] = avoid_cues
|
||||
|
||||
base_summary = str(config.get("summary") or hardcore_position_summary(config))
|
||||
if variant_keys and "variants=" not in base_summary:
|
||||
base_summary = f"{base_summary}; variants={','.join(variant_keys)}"
|
||||
@@ -149,6 +138,14 @@ def _merge_variant_metadata(config_json, variants):
|
||||
return json.dumps(config, ensure_ascii=True, sort_keys=True)
|
||||
|
||||
|
||||
def _variant_notes(variants):
|
||||
return "; ".join(
|
||||
f"{variant.get('key')} ({variant.get('status') or 'unknown'})"
|
||||
for variant in variants
|
||||
if variant.get("key")
|
||||
)
|
||||
|
||||
|
||||
class SxCPHardcorePositionPool:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
@@ -268,7 +265,7 @@ class _SxCPKrea2POVVariantFilter:
|
||||
"hardcore_position_config",
|
||||
"selected_variant_keys",
|
||||
"selected_positions",
|
||||
"prompt_cues",
|
||||
"selected_variant_notes",
|
||||
"summary",
|
||||
"variants_json",
|
||||
)
|
||||
@@ -297,12 +294,11 @@ class _SxCPKrea2POVVariantFilter:
|
||||
parsed = json.loads(config)
|
||||
selected_keys = parsed.get("krea2_variant_keys") or []
|
||||
selected_positions = parsed.get("positions") or []
|
||||
prompt_cues = _join_variant_cues(variants, "prompt_cues")
|
||||
return (
|
||||
config,
|
||||
",".join(str(key) for key in selected_keys),
|
||||
",".join(str(position) for position in selected_positions),
|
||||
prompt_cues,
|
||||
_variant_notes(variants),
|
||||
str(parsed.get("summary") or ""),
|
||||
json.dumps(variants, ensure_ascii=True, sort_keys=True),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user