Centralize formatter detail levels

This commit is contained in:
2026-06-27 13:56:21 +02:00
parent 6f6afb4d22
commit 333fa5eae6
8 changed files with 70 additions and 9 deletions
+5 -6
View File
@@ -4,9 +4,11 @@ import re
from typing import Any
try:
from . import formatter_detail as detail_policy
from . import formatter_input as input_policy
from . import route_metadata as route_metadata_policy
except ImportError: # Allows local smoke tests with `python tools/prompt_smoke.py`.
import formatter_detail as detail_policy
import formatter_input as input_policy
import route_metadata as route_metadata_policy
@@ -14,7 +16,7 @@ except ImportError: # Allows local smoke tests with `python tools/prompt_smoke.
OLD_TRIGGER = "sxcpinup_coloredpencil"
DEFAULT_TRIGGER = "sxcppnl7"
DETAIL_LEVELS = ("balanced", "concise", "dense")
DETAIL_LEVELS = detail_policy.DETAIL_LEVELS
STYLE_POLICIES = ("drop_style_tail", "keep_style_terms")
CAPTION_PROFILE_DEFAULT = "manual_controls"
@@ -72,7 +74,7 @@ POSITION_FAMILY_CAPTION_LABELS = {
def normalize_detail_level(value: str) -> str:
return value if value in DETAIL_LEVELS else "balanced"
return detail_policy.normalize_detail_level(value)
def normalize_style_policy(value: str) -> str:
@@ -107,10 +109,7 @@ def keep_style_terms(style_policy: str) -> bool:
def detail_allows(level: str, dense_only: bool = False) -> bool:
level = normalize_detail_level((level or "balanced").strip().lower())
if dense_only:
return level == "dense"
return level != "concise"
return detail_policy.detail_allows(level, dense_only=dense_only)
def strip_style_tail(text: str) -> str: