Share formatter field label policy
This commit is contained in:
+1
-20
@@ -23,26 +23,7 @@ STYLE_TAILS = [
|
||||
", coloured pencil comic illustration, crisp linework, hatching, soft pastel palette, warm sensual lighting, textured paper",
|
||||
]
|
||||
|
||||
PROMPT_FIELD_LABELS = (
|
||||
"Ages",
|
||||
"Body types",
|
||||
"Cast",
|
||||
"Cast descriptors",
|
||||
"Characters",
|
||||
"Scene",
|
||||
"Setting",
|
||||
"Pose",
|
||||
"Sexual pose",
|
||||
"Facial expression",
|
||||
"Facial expressions",
|
||||
"Clothing",
|
||||
"Erotic outfit",
|
||||
"Prop/detail",
|
||||
"Composition",
|
||||
"Role graph",
|
||||
"Use",
|
||||
"Avoid",
|
||||
)
|
||||
PROMPT_FIELD_LABELS = input_policy.prompt_field_labels()
|
||||
|
||||
ITEM_LABELS = (
|
||||
"Sexual pose",
|
||||
|
||||
@@ -73,7 +73,8 @@ routes:
|
||||
- JSON row detection from `metadata_json` or source text;
|
||||
- trigger-prefix stripping with route-specific trigger candidate lists;
|
||||
- `Avoid:` positive/negative splitting for fallback text;
|
||||
- prompt field extraction such as `Setting:` or `Composition:`;
|
||||
- the shared prompt field-label inventory and extraction such as `Setting:`,
|
||||
`Sexual scene:`, `Camera control:`, or `Composition:`;
|
||||
- row-value fallback from metadata fields to labeled prompt text.
|
||||
|
||||
It must not make formatter-style decisions. Krea prose, SDXL tags, and training
|
||||
@@ -261,8 +262,9 @@ Already isolated:
|
||||
first-person body geometry, and selected-position-axis priority before loose
|
||||
context fallback.
|
||||
- `formatter_input.py` owns shared metadata/source JSON detection, trigger
|
||||
stripping, prompt-field extraction, `Avoid:` splitting, and row-value
|
||||
fallback for Krea, SDXL, and caption routes.
|
||||
stripping, the shared prompt field-label inventory, prompt-field extraction,
|
||||
`Avoid:` splitting, and row-value fallback for Krea, SDXL, and caption
|
||||
routes.
|
||||
|
||||
Improve later:
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ Core helper ownership:
|
||||
| `krea_cast.py` | Shared formatter cast descriptor parsing, cast labels, cast prose, natural cast descriptor text, and label replacement used by Krea2 and caption routes. |
|
||||
| `prompt_hygiene.py` | Generic prompt, caption, and negative-prompt cleanup. |
|
||||
| `row_normalization.py` | Final prompt-row and pair metadata normalization: trigger prepending, extra-positive append, negative merge/dedupe, caption-part joining, and embedded soft/hard row sanitation. |
|
||||
| `formatter_input.py` | Shared formatter input parsing: text cleanup, metadata/source JSON detection, trigger-prefix stripping, `Avoid:` splitting, prompt-field extraction, and metadata row-value fallback. |
|
||||
| `formatter_input.py` | Shared formatter input parsing: text cleanup, metadata/source JSON detection, trigger-prefix stripping, shared prompt field-label inventory, `Avoid:` splitting, prompt-field extraction, and metadata row-value fallback. |
|
||||
| `sdxl_presets.py` | SDXL style presets, quality presets, default negative prompt, and metadata-family tag hints used by the SDXL formatter and node choice lists. |
|
||||
|
||||
## Node IO Map
|
||||
|
||||
@@ -30,6 +30,10 @@ DEFAULT_PROMPT_FIELD_LABELS = (
|
||||
)
|
||||
|
||||
|
||||
def prompt_field_labels() -> tuple[str, ...]:
|
||||
return DEFAULT_PROMPT_FIELD_LABELS
|
||||
|
||||
|
||||
def clean_text(value: Any) -> str:
|
||||
text = "" if value is None else str(value)
|
||||
text = text.replace("\n", " ")
|
||||
|
||||
+1
-20
@@ -69,26 +69,7 @@ TRIGGER_CANDIDATES = (
|
||||
"sxcpinup_coloredpencil",
|
||||
"sxcppnl7",
|
||||
)
|
||||
PROMPT_FIELD_LABELS = (
|
||||
"Ages",
|
||||
"Body types",
|
||||
"Cast",
|
||||
"Cast descriptors",
|
||||
"Characters",
|
||||
"Scene",
|
||||
"Setting",
|
||||
"Pose",
|
||||
"Sexual pose",
|
||||
"Facial expression",
|
||||
"Facial expressions",
|
||||
"Clothing",
|
||||
"Erotic outfit",
|
||||
"Prop/detail",
|
||||
"Composition",
|
||||
"Role graph",
|
||||
"Use",
|
||||
"Avoid",
|
||||
)
|
||||
PROMPT_FIELD_LABELS = input_policy.prompt_field_labels()
|
||||
|
||||
|
||||
def _clean(value: Any) -> str:
|
||||
|
||||
+1
-21
@@ -27,27 +27,7 @@ SDXL_DEFAULT_NEGATIVE = sdxl_policy.SDXL_DEFAULT_NEGATIVE
|
||||
SDXL_ACTION_FAMILY_TAGS = sdxl_policy.SDXL_ACTION_FAMILY_TAGS
|
||||
SDXL_POSITION_FAMILY_TAGS = sdxl_policy.SDXL_POSITION_FAMILY_TAGS
|
||||
|
||||
PROMPT_FIELD_LABELS = (
|
||||
"Ages",
|
||||
"Body types",
|
||||
"Cast",
|
||||
"Cast descriptors",
|
||||
"Characters",
|
||||
"Scene",
|
||||
"Setting",
|
||||
"Pose",
|
||||
"Sexual pose",
|
||||
"Sexual scene",
|
||||
"Facial expression",
|
||||
"Facial expressions",
|
||||
"Clothing",
|
||||
"Erotic outfit",
|
||||
"Composition",
|
||||
"Role graph",
|
||||
"Camera control",
|
||||
"Use",
|
||||
"Avoid",
|
||||
)
|
||||
PROMPT_FIELD_LABELS = input_policy.prompt_field_labels()
|
||||
|
||||
|
||||
def sdxl_style_preset_choices() -> list[str]:
|
||||
|
||||
@@ -882,6 +882,27 @@ def smoke_formatter_input_policy() -> None:
|
||||
formatter_input.row_value({"prompt": source_row["prompt"]}, "scene_text", ("Setting",)) == "quiet studio",
|
||||
"Row value prompt fallback changed",
|
||||
)
|
||||
_expect(
|
||||
krea_formatter.PROMPT_FIELD_LABELS is formatter_input.DEFAULT_PROMPT_FIELD_LABELS,
|
||||
"Krea formatter field-label inventory should delegate to formatter_input",
|
||||
)
|
||||
_expect(
|
||||
sdxl_formatter.PROMPT_FIELD_LABELS is formatter_input.DEFAULT_PROMPT_FIELD_LABELS,
|
||||
"SDXL formatter field-label inventory should delegate to formatter_input",
|
||||
)
|
||||
_expect(
|
||||
caption_naturalizer.PROMPT_FIELD_LABELS is formatter_input.DEFAULT_PROMPT_FIELD_LABELS,
|
||||
"Caption formatter field-label inventory should delegate to formatter_input",
|
||||
)
|
||||
labeled_prompt = "Sexual scene: close-contact action. Camera control: side view. Composition: centered frame."
|
||||
_expect(
|
||||
formatter_input.prompt_field(labeled_prompt, "Sexual scene") == "close-contact action",
|
||||
"Shared formatter field-label inventory lost Sexual scene parsing",
|
||||
)
|
||||
_expect(
|
||||
formatter_input.prompt_field(labeled_prompt, "Camera control") == "side view",
|
||||
"Shared formatter field-label inventory lost Camera control parsing",
|
||||
)
|
||||
|
||||
_expect(krea_formatter._clean("a b , c") == formatter_input.clean_text("a b , c"), "Krea clean helper is not delegated")
|
||||
_expect(sdxl_formatter._clean("a b , c") == formatter_input.clean_text("a b , c"), "SDXL clean helper is not delegated")
|
||||
|
||||
Reference in New Issue
Block a user