Repeat shared context in every chunk
tests / test (push) Canceled after 0s
tests / windows-storage (push) Canceled after 0s

This commit is contained in:
2026-10-15 09:19:13 +00:00
parent 5612719c4f
commit a53651496c
3 changed files with 16 additions and 9 deletions
+4 -3
View File
@@ -29,16 +29,17 @@ is unavailable.
Example output:
```text
Preserve the same character and environment.
[0-4s]
Preserve the same character and environment.
0-2s: The character walks forward and looks toward the light.
2-4s: The character stops and looks toward the light.
overall_soundscape: Quiet room tone and footsteps.
non_diegetic_music: Low cinematic pulse.
[4-8s]
Preserve the same character and environment.
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.
non_diegetic_music: Low cinematic pulse.
```
+7 -5
View File
@@ -106,22 +106,24 @@ def format_sequence_prompt(
``start-end s:`` lines rather than creating additional Timeline sections.
"""
sections: list[str] = []
directive = str(shared_directive or "").strip()
if directive:
sections.append(directive)
sound = str(soundscape or "").strip() or "N/A"
music_text = str(music or "").strip() or "N/A"
sections: list[str] = []
cursor = 0.0
for clip in sequence["clips"]:
duration = float(clip["duration"])
chunk_lines = [f"[{cursor:g}-{cursor + duration:g}s]"]
if directive:
chunk_lines.append(directive)
for slot in clip["slots"]:
start = float(slot["start"])
end = float(slot["end"])
chunk_lines.append(f"{start:g}-{end:g}s: {slot['text']}")
chunk_lines.append(f"overall_soundscape: {sound}")
chunk_lines.append(f"non_diegetic_music: {music_text}")
sections.append("\n".join(chunk_lines))
cursor += duration
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'}")
return "\n\n".join(sections).strip()
+5 -1
View File
@@ -33,6 +33,9 @@ def test_builder_emits_one_absolute_timeline_prompt_from_clip_local_slots():
assert "[5-9s]" not in result
assert "overall_soundscape: Quiet street ambience." in result
assert "non_diegetic_music: Low cinematic pulse." in result
assert result.count("Preserve the same character and environment.") == 2
assert result.count("overall_soundscape: Quiet street ambience.") == 2
assert result.count("non_diegetic_music: Low cinematic pulse.") == 2
def test_normalizer_orders_slots_fills_missing_clips_and_shares_duration():
@@ -63,4 +66,5 @@ def test_node_schema_has_single_string_output_and_serialized_editor_state():
assert DumasH3SequencePromptBuilder.RETURN_TYPES == ("STRING",)
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("Directive\n\noverall_soundscape:")
assert result[0].startswith("[0-4s]\nDirective")
assert result[0].count("overall_soundscape:") == 1