Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7de62226f2 |
+13
-2
@@ -27,6 +27,12 @@ _H3_PLAN_IMAGE_BINDINGS_CAP = 128
|
|||||||
_H3_PLAN_IMAGE_SLOTS = 9
|
_H3_PLAN_IMAGE_SLOTS = 9
|
||||||
_FOLDER_IMAGE_EXTS = (".png", ".jpg", ".jpeg", ".webp", ".bmp", ".gif", ".tiff", ".tif")
|
_FOLDER_IMAGE_EXTS = (".png", ".jpg", ".jpeg", ".webp", ".bmp", ".gif", ".tiff", ".tif")
|
||||||
_ANCHOR_STYLE_H3_NOTE = ""
|
_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_REF_SLOTS = 9
|
||||||
_H3_PROMPT_MAX_CHARS = 7000
|
_H3_PROMPT_MAX_CHARS = 7000
|
||||||
_PICTURE_TAG_RE = re.compile(r"<\s*picture[\s_\-]*(\d+)\s*>", re.I)
|
_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(), "")
|
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):
|
def _clean_input_token_value(value):
|
||||||
cleaned = ""
|
cleaned = ""
|
||||||
if value is not None:
|
if value is not None:
|
||||||
@@ -2704,9 +2715,9 @@ class DumasAnchorStyleNode:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def build_anchor(self, anchor_style, style_description):
|
def build_anchor(self, anchor_style, style_description):
|
||||||
text = str(style_description or "").strip()
|
text = _clean_anchor_style_text(style_description)
|
||||||
if not text:
|
if not text:
|
||||||
text = _anchor_style_description(anchor_style)
|
text = _clean_anchor_style_text(_anchor_style_description(anchor_style))
|
||||||
return (text,)
|
return (text,)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -688,6 +688,19 @@ class DumasImageNodeTests(unittest.TestCase):
|
|||||||
self.assertIn("real time", result[0])
|
self.assertIn("real time", result[0])
|
||||||
self.assertNotIn("persistent camera language", result[0])
|
self.assertNotIn("persistent camera language", result[0])
|
||||||
|
|
||||||
|
def test_anchor_style_node_strips_legacy_persistent_anchor_note(self):
|
||||||
|
node = self.image_nodes.DumasAnchorStyleNode()
|
||||||
|
legacy = (
|
||||||
|
"Gritty handheld realism. Keep this anchor focused on persistent camera "
|
||||||
|
"language, lighting, texture, environment treatment, and tone; do not "
|
||||||
|
"name characters or describe one-off actions."
|
||||||
|
)
|
||||||
|
|
||||||
|
result = node.build_anchor("cinematic action movie", legacy)
|
||||||
|
|
||||||
|
self.assertEqual(result[0], "Gritty handheld realism.")
|
||||||
|
self.assertNotIn("persistent camera language", result[0])
|
||||||
|
|
||||||
def test_anchor_style_node_prefers_manual_description_edits(self):
|
def test_anchor_style_node_prefers_manual_description_edits(self):
|
||||||
node = self.image_nodes.DumasAnchorStyleNode()
|
node = self.image_nodes.DumasAnchorStyleNode()
|
||||||
custom = "Lo-fi pirate broadcast with smeared highlights and anxious zoom corrections."
|
custom = "Lo-fi pirate broadcast with smeared highlights and anxious zoom corrections."
|
||||||
|
|||||||
Reference in New Issue
Block a user