From 23b686e58275cfec0239f8b0be4276e68c679b48 Mon Sep 17 00:00:00 2001 From: ukr8b3g-cmyk Date: Sat, 15 Aug 2026 13:10:34 +0900 Subject: [PATCH] Relax timeline coverage and add prompt diagnostics --- reference.py | 23 +++++++---- reference_audio.py | 4 +- tests/test_v2_prompts.py | 76 ++++++++++++++++++++++++++++++++-- tests/test_v32_reference.py | 4 ++ v2/prompts.py | 82 +++++++++++++++++++++++++++++-------- v2/sequence.py | 2 +- 6 files changed, 161 insertions(+), 30 deletions(-) diff --git a/reference.py b/reference.py index d079298..5e645d8 100644 --- a/reference.py +++ b/reference.py @@ -197,22 +197,29 @@ def validate_reference_prompts(prompts: list[str], reference_count: int) -> str: for prompt in prompts: found.update(int(value) for value in _PICTURE_TAG.findall(str(prompt))) invalid = sorted(value for value in found if value < 1 or value > reference_count) + warnings: list[str] = [] if invalid: unavailable = ", ".join(f"" for value in invalid) - return ( - f"Warning: prompt references unavailable {unavailable}; only " + warnings.append( + f"H3C-P102 Warning: prompt references unavailable {unavailable}; only " f"{reference_count} active reference image(s) reached the Sampler. " "ComfyUI Core permits this and generation will continue, but the " "unavailable reference may be ignored or hallucinated. Enable the " "corresponding Reference Image input or remove the unavailable tag." ) - if not found: - return ( - "Reference images are connected but the prompt contains no " - " tag; images still condition generation, but explicit " - "identity references are recommended." + missing = sorted(set(range(1, reference_count + 1)) - found) + if missing: + labels = ", ".join(f"" for value in missing) + detail = ( + "the prompt contains no tag" + if not found + else f"connected reference {labels} is not explicitly mentioned in the prompt" ) - return "" + warnings.append( + f"H3C-P103 Warning: {detail}; images still condition generation, but " + "explicit identity references are recommended." + ) + return "\n".join(warnings) def encode_reference_prompt( diff --git a/reference_audio.py b/reference_audio.py index 6c069b6..6470d8e 100644 --- a/reference_audio.py +++ b/reference_audio.py @@ -202,14 +202,14 @@ def validate_reference_audio_prompts( ) for value in unavailable: warnings.append( - f"Warning: prompt references unavailable