Strip legacy anchor style note
This commit is contained in:
+13
-2
@@ -27,6 +27,12 @@ _H3_PLAN_IMAGE_BINDINGS_CAP = 128
|
||||
_H3_PLAN_IMAGE_SLOTS = 9
|
||||
_FOLDER_IMAGE_EXTS = (".png", ".jpg", ".jpeg", ".webp", ".bmp", ".gif", ".tiff", ".tif")
|
||||
_ANCHOR_STYLE_H3_NOTE = ""
|
||||
_ANCHOR_STYLE_LEGACY_NOTE_RE = re.compile(
|
||||
r"\s*Keep this anchor focused on persistent camera language, lighting, "
|
||||
r"texture, environment treatment, and tone; do not name characters or "
|
||||
r"describe one-off actions\.?",
|
||||
re.I,
|
||||
)
|
||||
_H3_PROMPT_REF_SLOTS = 9
|
||||
_H3_PROMPT_MAX_CHARS = 7000
|
||||
_PICTURE_TAG_RE = re.compile(r"<\s*picture[\s_\-]*(\d+)\s*>", re.I)
|
||||
@@ -420,6 +426,11 @@ def _anchor_style_description(style_name):
|
||||
return _ANCHOR_STYLE_PRESETS.get(str(style_name or "").strip().lower(), "")
|
||||
|
||||
|
||||
def _clean_anchor_style_text(text):
|
||||
cleaned = _ANCHOR_STYLE_LEGACY_NOTE_RE.sub("", str(text or ""))
|
||||
return re.sub(r"[ \t]{2,}", " ", cleaned).strip()
|
||||
|
||||
|
||||
def _clean_input_token_value(value):
|
||||
cleaned = ""
|
||||
if value is not None:
|
||||
@@ -2704,9 +2715,9 @@ class DumasAnchorStyleNode:
|
||||
}
|
||||
|
||||
def build_anchor(self, anchor_style, style_description):
|
||||
text = str(style_description or "").strip()
|
||||
text = _clean_anchor_style_text(style_description)
|
||||
if not text:
|
||||
text = _anchor_style_description(anchor_style)
|
||||
text = _clean_anchor_style_text(_anchor_style_description(anchor_style))
|
||||
return (text,)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user