Add prompt-driven reference image routing
This commit is contained in:
@@ -61,11 +61,42 @@ def test_normalizer_rejects_invalid_slot_ranges(bad):
|
||||
normalize_sequence(bad, clip_count=1, default_seconds=4)
|
||||
|
||||
|
||||
def test_node_schema_has_single_string_output_and_serialized_editor_state():
|
||||
schema = DumasH3SequencePromptBuilder.INPUT_TYPES()["required"]
|
||||
assert DumasH3SequencePromptBuilder.RETURN_TYPES == ("STRING", "INT", "FLOAT")
|
||||
def test_node_schema_has_prompt_outputs_reference_bundle_and_serialized_editor_state():
|
||||
inputs = DumasH3SequencePromptBuilder.INPUT_TYPES()
|
||||
schema = inputs["required"]
|
||||
assert DumasH3SequencePromptBuilder.RETURN_TYPES == (
|
||||
"STRING", "INT", "FLOAT", "H3_CONTINUUM_REFERENCE_IMAGES_V39"
|
||||
)
|
||||
assert "reference_image_1" in inputs["optional"]
|
||||
assert schema["timeline_json"][1]["multiline"] is True
|
||||
result = DumasH3SequencePromptBuilder().build(1, 4, "Directive", json.dumps(default_sequence(1, 4)), "N/A", "N/A")
|
||||
assert result[0].startswith("[0-4s]\nDirective")
|
||||
assert result[0].count("overall_soundscape:") == 1
|
||||
assert result[1:] == (1, 4.0)
|
||||
assert result[1] == 1
|
||||
assert result[2] == 4.0
|
||||
assert result[3].reference_use == "Per chunk"
|
||||
assert result[3].selectors == ("off",) * 9
|
||||
|
||||
|
||||
def test_builder_routes_connected_references_only_to_mentioning_chunks():
|
||||
value = {
|
||||
"clips": [
|
||||
{"slots": [{"start": 0, "end": 4, "text": "@R1 walks toward @R2."}]},
|
||||
{"slots": [{"start": 0, "end": 4, "text": "The camera follows @r2."}]},
|
||||
{"slots": [{"start": 0, "end": 4, "text": "A wide shot with no reference."}]},
|
||||
]
|
||||
}
|
||||
result = DumasH3SequencePromptBuilder().build(
|
||||
3,
|
||||
4,
|
||||
"",
|
||||
json.dumps(value),
|
||||
"",
|
||||
"",
|
||||
reference_image_1=object(),
|
||||
reference_image_2=object(),
|
||||
)
|
||||
bundle = result[3]
|
||||
assert bundle.reference_use == "Per chunk"
|
||||
assert bundle.selectors == ("1", "1,2", "off", "off", "off", "off", "off", "off", "off")
|
||||
assert bundle.images[0] is not None and bundle.images[1] is not None
|
||||
|
||||
Reference in New Issue
Block a user