Expose H3 prompt curator components

This commit is contained in:
2026-09-09 15:34:06 +00:00
parent 388de1d837
commit e973a0d785
3 changed files with 63 additions and 10 deletions
+46 -8
View File
@@ -1249,12 +1249,19 @@ def curate_h3_prompt(
selected = _selected_prompt_refs(action_prompt, normalized_refs)
picture_map = {slot_number: index for index, (slot_number, _ref) in enumerate(selected, 1)}
action = _replace_reference_tags(action_prompt, picture_map)
anchor_text = _reference_text(anchor)
soundscape_text = _reference_text(soundscape)
bgm_text = _reference_text(bgm)
reference_description = ""
if selected:
reference_description = " ".join(
_reference_context(ref, picture_number)
for picture_number, (_slot, ref) in enumerate(selected, 1)
)
prompt_parts = []
_append_prompt_section(prompt_parts, "Scene anchor", anchor)
if selected:
contexts = [_reference_context(ref, picture_number) for picture_number, (_slot, ref) in enumerate(selected, 1)]
_append_prompt_section(prompt_parts, "Reference context", " ".join(contexts))
_append_prompt_section(prompt_parts, "Scene anchor", anchor_text)
_append_prompt_section(prompt_parts, "Reference context", reference_description)
_append_prompt_section(prompt_parts, "Action", action)
if anatomy_guard == "on" or (anatomy_guard == "auto" and any(ref.get("kind") == "character" for _slot, ref in selected)):
_append_prompt_section(prompt_parts, "Anatomy guard", _ANATOMY_GUARD_TEXT)
@@ -1262,14 +1269,16 @@ def curate_h3_prompt(
subject_count_guard == "auto" and any(ref.get("kind") == "character" for _slot, ref in selected)
):
_append_prompt_section(prompt_parts, "Subject count guard", _subject_count_guard_text(selected))
_append_prompt_section(prompt_parts, "overall_soundscape", soundscape)
_append_prompt_section(prompt_parts, "background_music", bgm)
_append_prompt_section(prompt_parts, "overall_soundscape", soundscape_text)
_append_prompt_section(prompt_parts, "background_music", bgm_text)
prompt = "\n\n".join(prompt_parts).strip()
if len(prompt) > _H3_PROMPT_MAX_CHARS:
prompt = prompt[: _H3_PROMPT_MAX_CHARS - 3].rstrip() + "..."
images = [_reference_image(ref) for _slot, ref in selected]
images.extend([None] * (_H3_PROMPT_REF_SLOTS - len(images)))
selected_refs = [ref for _slot, ref in selected]
selected_refs.extend([None] * (_H3_PROMPT_REF_SLOTS - len(selected_refs)))
debug = (
f"Selected {len(selected)} reference(s): "
+ ", ".join(
@@ -1279,7 +1288,17 @@ def curate_h3_prompt(
if selected
else "Selected 0 references."
)
return (prompt, *images[:_H3_PROMPT_REF_SLOTS], len(selected), debug)
return (
prompt,
*images[:_H3_PROMPT_REF_SLOTS],
len(selected),
debug,
anchor_text,
soundscape_text,
bgm_text,
*selected_refs[:_H3_PROMPT_REF_SLOTS],
reference_description,
)
def _parse_positive_int(value):
@@ -2666,7 +2685,13 @@ class DumasH3PromptCuratorNode:
"compacted so only mentioned names, aliases, or explicit <Picture N>/<refN> "
"tags are sent onward."
)
RETURN_TYPES = ("STRING",) + ("IMAGE",) * _H3_PROMPT_REF_SLOTS + ("INT", "STRING")
RETURN_TYPES = (
("STRING",)
+ ("IMAGE",) * _H3_PROMPT_REF_SLOTS
+ ("INT", "STRING", "STRING", "STRING", "STRING")
+ (_REFERENCE_TYPE,) * _H3_PROMPT_REF_SLOTS
+ ("STRING",)
)
RETURN_NAMES = (
"prompt",
"ref_image_1",
@@ -2680,6 +2705,19 @@ class DumasH3PromptCuratorNode:
"ref_image_9",
"reference_count",
"debug",
"anchor",
"sounds",
"bgm",
"original_ref_1",
"original_ref_2",
"original_ref_3",
"original_ref_4",
"original_ref_5",
"original_ref_6",
"original_ref_7",
"original_ref_8",
"original_ref_9",
"reference_description",
)
FUNCTION = "curate_prompt"
CATEGORY = "Dumas/MiniMax"