Extract caption text policy

This commit is contained in:
2026-06-27 11:58:18 +02:00
parent 2605fae3eb
commit f1567118b4
5 changed files with 396 additions and 189 deletions
+12 -6
View File
@@ -21,9 +21,13 @@ When a result is wrong, first identify which layer owns the bad text:
- Raw builder prompt already wrong: edit `prompt_builder.py` or the relevant
`categories/*.json` pool/template.
- Raw builder prompt acceptable, Krea2 output wrong: edit `krea_formatter.py`.
- Raw builder prompt acceptable, SDXL tags wrong: edit `sdxl_formatter.py`.
- Natural caption/training caption wrong: edit `caption_naturalizer.py`.
- Raw builder prompt acceptable, Krea2 output wrong: inspect `krea_formatter.py`
orchestration, then the owning Krea route/policy helper.
- Raw builder prompt acceptable, SDXL tags wrong: inspect `sdxl_formatter.py`
orchestration, then `sdxl_tag_policy.py` and `sdxl_tag_routes.py`.
- Natural caption/training caption wrong: inspect `caption_naturalizer.py`
orchestration, then `caption_text_policy.py`, `caption_policy.py`, and
`caption_metadata_routes.py`.
- UI/preview/loop behavior wrong: edit `__init__.py`, node family modules such
as `node_builder.py`, `node_seed_resolution.py`, `node_camera.py`,
`node_character.py`, `node_hardcore_position.py`, `node_formatter.py`,
@@ -125,6 +129,7 @@ Core helper ownership:
| `sdxl_presets.py` | SDXL formatter profiles, style presets, quality presets, default negative prompt, and metadata-family tag hints used by the SDXL formatter and node choice lists. |
| `sdxl_tag_policy.py` | SDXL tag splitting, tag-key dedupe, count inference, character descriptor tags, metadata-family/camera/explicit helper tags, and route dependency assembly used by `sdxl_formatter.py` and `sdxl_tag_routes.py`. |
| `caption_policy.py` | Caption naturalizer policy data and helpers: caption profiles, style tails, item labels, metadata-family caption labels, detail/style-policy normalization, clothing cleanup, and composition cleanup. |
| `caption_text_policy.py` | Caption sentence helpers, trigger wrapping, formatter-hint append, row-value fallback wrappers, cast text wrappers, single-caption front parsing, and metadata-route dependency assembly used by `caption_naturalizer.py` and `caption_metadata_routes.py`. |
## Node IO Map
@@ -332,7 +337,8 @@ Edit targets:
- Hardcore-specific expressions: usually `categories/sexual_poses.json` or named
hardcore expression pools.
- Character-level expression settings: slot config and `row_expression.py`.
- Formatter expression wording: `krea_formatter.py` or `caption_naturalizer.py`.
- Formatter expression wording: Krea route helpers, or `caption_text_policy.py`
and `caption_metadata_routes.py` for natural captions.
### Pose / Action
@@ -742,9 +748,9 @@ Naturalizer field consumption:
| Branch | Reads most from | Key functions |
| --- | --- | --- |
| Normal single/couple/group | subject fields, age/body, item, scene, expression, composition, camera scene | `caption_metadata_routes.single_from_row_result`, `caption_metadata_routes.couple_from_row_result`, `caption_metadata_routes.group_or_layout_from_row_result` |
| Configured cast/hardcore | `cast_descriptor_text`, `action_family`, `position_family`, `role_graph`, `item`, `scene_text`, expression, composition | `caption_metadata_routes.configured_cast_from_row_result`, `_metadata_action_label` |
| Configured cast/hardcore | `cast_descriptor_text`, `action_family`, `position_family`, `role_graph`, `item`, `scene_text`, expression, composition | `caption_metadata_routes.configured_cast_from_row_result`, `caption_text_policy.metadata_action_label` |
| Insta/OF pair | `softcore_row`, `hardcore_row`, pair options and continuity | `caption_metadata_routes.insta_of_pair_from_row_result` |
| Text fallback | `caption` or `prompt` text | `_text_to_prose` |
| Text fallback | `caption` or `prompt` text | `caption_naturalizer._text_to_prose`, with sentence helpers delegated to `caption_text_policy.py` |
### Final Text Hygiene