2026-07-15 23:01:07 +08:00
|
|
|
"""Canonical gradual-character workflow catalog.
|
|
|
|
|
|
|
|
|
|
The node id is the durable identity. ``node_key`` is a semantic label and
|
|
|
|
|
older installations already contain the v1 labels below, so callers must use
|
|
|
|
|
``canonical_gradual_node_key`` instead of open-coding aliases.
|
|
|
|
|
"""
|
2026-07-05 09:35:49 +08:00
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from typing import Any
|
|
|
|
|
|
2026-07-27 11:50:08 +08:00
|
|
|
# Re-exported: the pure rename table lives in core so the data layer can use
|
|
|
|
|
# it without importing an engine.
|
|
|
|
|
from core.workflow_node_keys import ( # noqa: F401
|
|
|
|
|
LEGACY_CHARACTER_GRADUAL_NODE_KEYS,
|
|
|
|
|
canonical_gradual_node_key,
|
|
|
|
|
)
|
|
|
|
|
|
2026-07-05 09:35:49 +08:00
|
|
|
|
2026-07-15 23:01:07 +08:00
|
|
|
CHARACTER_GRADUAL_TEMPLATE_VERSION = "character_gradual_v2"
|
|
|
|
|
|
|
|
|
|
|
2026-07-05 09:35:49 +08:00
|
|
|
CHARACTER_GRADUAL_STEPS: tuple[dict[str, Any], ...] = (
|
|
|
|
|
{
|
|
|
|
|
"node_key": "profile_brief",
|
2026-07-15 23:01:07 +08:00
|
|
|
"title": "拆解人设",
|
2026-07-05 09:35:49 +08:00
|
|
|
"step_name": "profile_brief",
|
2026-07-15 23:01:07 +08:00
|
|
|
"description": "Extract identity, personality, appearance, outfit, and consistency anchors.",
|
|
|
|
|
"node_type": "planning",
|
2026-07-05 09:35:49 +08:00
|
|
|
"sort_order": 10,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "RS",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
2026-07-10 01:25:15 +08:00
|
|
|
{
|
|
|
|
|
"node_key": "prompt_plan",
|
2026-07-15 23:01:07 +08:00
|
|
|
"title": "提示词规划",
|
2026-07-10 01:25:15 +08:00
|
|
|
"step_name": "prompt_plan",
|
2026-07-15 23:01:07 +08:00
|
|
|
"description": "Plan prompts and inheritance rules for every downstream image stage.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"node_type": "planning",
|
|
|
|
|
"sort_order": 20,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "TS",
|
2026-07-10 01:25:15 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"node_key": "material_bind",
|
2026-07-15 23:01:07 +08:00
|
|
|
"title": "预选素材",
|
2026-07-10 01:25:15 +08:00
|
|
|
"step_name": "material_bind",
|
2026-07-15 23:01:07 +08:00
|
|
|
"description": "Bind style, composition, clothing, shoes, accessory, and temporary references.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"node_type": "reference_binding",
|
|
|
|
|
"sort_order": 30,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "SC",
|
2026-07-10 01:25:15 +08:00
|
|
|
},
|
2026-07-05 09:35:49 +08:00
|
|
|
{
|
|
|
|
|
"node_key": "headshot",
|
2026-07-15 23:01:07 +08:00
|
|
|
"title": "头像",
|
2026-07-05 09:35:49 +08:00
|
|
|
"step_name": "headshot",
|
2026-07-15 23:01:07 +08:00
|
|
|
"description": "Face, hair, eyes, expression, and the primary identity anchor.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 40,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "TX",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
"node_key": "upper_body",
|
|
|
|
|
"title": "上半身像",
|
|
|
|
|
"step_name": "upper_body",
|
|
|
|
|
"description": "Upper-body costume, posture, silhouette, and identity continuity.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 50,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "SS",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
"node_key": "lower_body",
|
|
|
|
|
"title": "下半身像",
|
|
|
|
|
"step_name": "lower_body",
|
|
|
|
|
"description": "Waist, hips, legs, footwear, proportions, and lower-body details.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 60,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "XS",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
"node_key": "full_body",
|
|
|
|
|
"title": "全身像",
|
|
|
|
|
"step_name": "full_body",
|
|
|
|
|
"description": "Complete outfit, body proportions, footwear, and full silhouette.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 70,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "QS",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
"node_key": "turnaround",
|
|
|
|
|
"title": "三视图",
|
|
|
|
|
"step_name": "turnaround",
|
|
|
|
|
"description": "Front, side, and back views with consistent proportions and costume structure.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 80,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "ST",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
"node_key": "design_sheet",
|
|
|
|
|
"title": "设定图",
|
|
|
|
|
"step_name": "design_sheet",
|
|
|
|
|
"description": "Expressions, poses, hands, accessories, and reusable design callouts.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 90,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "SD",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
"node_key": "style_lock",
|
|
|
|
|
"title": "高清修复",
|
|
|
|
|
"step_name": "style_lock",
|
|
|
|
|
"description": "High-resolution restoration and final identity/style consistency pass.",
|
2026-07-10 01:25:15 +08:00
|
|
|
"sort_order": 100,
|
2026-07-15 23:01:07 +08:00
|
|
|
"stage_code": "XF",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"node_key": "profile_card",
|
|
|
|
|
"title": "建立档案卡",
|
|
|
|
|
"step_name": "profile_card",
|
|
|
|
|
"description": "Validate required assets, create an immutable profile card, and archive the workflow.",
|
|
|
|
|
"node_type": "archive",
|
|
|
|
|
"sort_order": 110,
|
|
|
|
|
"stage_code": "DA",
|
2026-07-05 09:35:49 +08:00
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2026-07-15 23:01:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def gradual_stage_code(node_key: str | None) -> str:
|
|
|
|
|
canonical = canonical_gradual_node_key(node_key)
|
|
|
|
|
for step in CHARACTER_GRADUAL_STEPS:
|
|
|
|
|
if step["node_key"] == canonical:
|
|
|
|
|
return str(step["stage_code"])
|
|
|
|
|
return "RD"
|
|
|
|
|
|
|
|
|
|
|
2026-07-05 09:35:49 +08:00
|
|
|
def gradual_node_templates() -> list[dict[str, Any]]:
|
|
|
|
|
return [
|
|
|
|
|
{
|
2026-07-15 23:01:07 +08:00
|
|
|
**{key: value for key, value in step.items() if key != "stage_code"},
|
2026-07-10 01:25:15 +08:00
|
|
|
"node_type": step.get("node_type", "generation"),
|
2026-07-05 09:35:49 +08:00
|
|
|
"status": "draft",
|
|
|
|
|
"branch_name": "main",
|
2026-07-15 23:01:07 +08:00
|
|
|
"metadata": {
|
|
|
|
|
"template": CHARACTER_GRADUAL_TEMPLATE_VERSION,
|
|
|
|
|
"canonical_node_key": step["node_key"],
|
|
|
|
|
"stage_code": step["stage_code"],
|
|
|
|
|
},
|
2026-07-05 09:35:49 +08:00
|
|
|
}
|
|
|
|
|
for step in CHARACTER_GRADUAL_STEPS
|
|
|
|
|
]
|