Group shot timings inside chunk blocks
This commit is contained in:
@@ -32,10 +32,12 @@ Example output:
|
|||||||
Preserve the same character and environment.
|
Preserve the same character and environment.
|
||||||
|
|
||||||
[0-4s]
|
[0-4s]
|
||||||
The character walks forward and looks toward the light.
|
0-2s: The character walks forward and looks toward the light.
|
||||||
|
2-4s: The character stops and looks toward the light.
|
||||||
|
|
||||||
[4-8s]
|
[4-8s]
|
||||||
Continue seamlessly as the character raises one hand.
|
0-2s: Continue seamlessly as the character raises one hand.
|
||||||
|
2-4s: The character looks toward the camera.
|
||||||
|
|
||||||
overall_soundscape: Quiet room tone and footsteps.
|
overall_soundscape: Quiet room tone and footsteps.
|
||||||
non_diegetic_music: Low cinematic pulse.
|
non_diegetic_music: Low cinematic pulse.
|
||||||
|
|||||||
+13
-5
@@ -99,7 +99,12 @@ def format_sequence_prompt(
|
|||||||
soundscape: str = "",
|
soundscape: str = "",
|
||||||
music: str = "",
|
music: str = "",
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Flatten clip-local slots into the absolute H3 Timeline prompt format."""
|
"""Format uniform clips as chunk blocks with relative shot timings.
|
||||||
|
|
||||||
|
Continuum treats square-bracket ranges as physical/logical chunk markers.
|
||||||
|
Shot timings belong inside each chunk and must therefore use plain
|
||||||
|
``start-end s:`` lines rather than creating additional Timeline sections.
|
||||||
|
"""
|
||||||
|
|
||||||
sections: list[str] = []
|
sections: list[str] = []
|
||||||
directive = str(shared_directive or "").strip()
|
directive = str(shared_directive or "").strip()
|
||||||
@@ -107,11 +112,14 @@ def format_sequence_prompt(
|
|||||||
sections.append(directive)
|
sections.append(directive)
|
||||||
cursor = 0.0
|
cursor = 0.0
|
||||||
for clip in sequence["clips"]:
|
for clip in sequence["clips"]:
|
||||||
|
duration = float(clip["duration"])
|
||||||
|
chunk_lines = [f"[{cursor:g}-{cursor + duration:g}s]"]
|
||||||
for slot in clip["slots"]:
|
for slot in clip["slots"]:
|
||||||
start = cursor + float(slot["start"])
|
start = float(slot["start"])
|
||||||
end = cursor + float(slot["end"])
|
end = float(slot["end"])
|
||||||
sections.append(f"[{start:g}-{end:g}s]\n{slot['text']}")
|
chunk_lines.append(f"{start:g}-{end:g}s: {slot['text']}")
|
||||||
cursor += float(clip["duration"])
|
sections.append("\n".join(chunk_lines))
|
||||||
|
cursor += duration
|
||||||
sections.append(f"overall_soundscape: {str(soundscape or '').strip() or 'N/A'}")
|
sections.append(f"overall_soundscape: {str(soundscape or '').strip() or 'N/A'}")
|
||||||
sections.append(f"non_diegetic_music: {str(music or '').strip() or 'N/A'}")
|
sections.append(f"non_diegetic_music: {str(music or '').strip() or 'N/A'}")
|
||||||
return "\n\n".join(sections).strip()
|
return "\n\n".join(sections).strip()
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def test_builder_emits_one_absolute_timeline_prompt_from_clip_local_slots():
|
|||||||
sequence = normalize_sequence(
|
sequence = normalize_sequence(
|
||||||
{"clips": [
|
{"clips": [
|
||||||
{"duration": 4, "slots": [{"start": 0, "end": 2, "text": "Walk forward."}]},
|
{"duration": 4, "slots": [{"start": 0, "end": 2, "text": "Walk forward."}]},
|
||||||
{"duration": 5, "slots": [{"start": 1, "end": 5, "text": "Turn toward the light."}]},
|
{"duration": 5, "slots": [{"start": 1, "end": 4, "text": "Turn toward the light."}]},
|
||||||
]},
|
]},
|
||||||
clip_count=2,
|
clip_count=2,
|
||||||
default_seconds=4,
|
default_seconds=4,
|
||||||
@@ -27,8 +27,10 @@ def test_builder_emits_one_absolute_timeline_prompt_from_clip_local_slots():
|
|||||||
soundscape="Quiet street ambience.",
|
soundscape="Quiet street ambience.",
|
||||||
music="Low cinematic pulse.",
|
music="Low cinematic pulse.",
|
||||||
)
|
)
|
||||||
assert "[0-2s]" in result
|
assert "[0-4s]\n0-2s: First." in result
|
||||||
assert "[5-9s]" in result
|
assert "[4-8s]\n1-4s: Turn toward the light." in result
|
||||||
|
assert "[0-2s]" not in result
|
||||||
|
assert "[5-9s]" not in result
|
||||||
assert "overall_soundscape: Quiet street ambience." in result
|
assert "overall_soundscape: Quiet street ambience." in result
|
||||||
assert "non_diegetic_music: Low cinematic pulse." in result
|
assert "non_diegetic_music: Low cinematic pulse." in result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user