Repeat shared context in every chunk
This commit is contained in:
@@ -29,16 +29,17 @@ is unavailable.
|
|||||||
Example output:
|
Example output:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Preserve the same character and environment.
|
|
||||||
|
|
||||||
[0-4s]
|
[0-4s]
|
||||||
|
Preserve the same character and environment.
|
||||||
0-2s: 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.
|
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]
|
[4-8s]
|
||||||
|
Preserve the same character and environment.
|
||||||
0-2s: 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.
|
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.
|
||||||
```
|
```
|
||||||
|
|||||||
+7
-5
@@ -106,22 +106,24 @@ def format_sequence_prompt(
|
|||||||
``start-end s:`` lines rather than creating additional Timeline sections.
|
``start-end s:`` lines rather than creating additional Timeline sections.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sections: list[str] = []
|
|
||||||
directive = str(shared_directive or "").strip()
|
directive = str(shared_directive or "").strip()
|
||||||
if directive:
|
sound = str(soundscape or "").strip() or "N/A"
|
||||||
sections.append(directive)
|
music_text = str(music or "").strip() or "N/A"
|
||||||
|
sections: list[str] = []
|
||||||
cursor = 0.0
|
cursor = 0.0
|
||||||
for clip in sequence["clips"]:
|
for clip in sequence["clips"]:
|
||||||
duration = float(clip["duration"])
|
duration = float(clip["duration"])
|
||||||
chunk_lines = [f"[{cursor:g}-{cursor + duration:g}s]"]
|
chunk_lines = [f"[{cursor:g}-{cursor + duration:g}s]"]
|
||||||
|
if directive:
|
||||||
|
chunk_lines.append(directive)
|
||||||
for slot in clip["slots"]:
|
for slot in clip["slots"]:
|
||||||
start = float(slot["start"])
|
start = float(slot["start"])
|
||||||
end = float(slot["end"])
|
end = float(slot["end"])
|
||||||
chunk_lines.append(f"{start:g}-{end:g}s: {slot['text']}")
|
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))
|
sections.append("\n".join(chunk_lines))
|
||||||
cursor += duration
|
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()
|
return "\n\n".join(sections).strip()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ def test_builder_emits_one_absolute_timeline_prompt_from_clip_local_slots():
|
|||||||
assert "[5-9s]" 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
|
||||||
|
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():
|
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 DumasH3SequencePromptBuilder.RETURN_TYPES == ("STRING",)
|
||||||
assert schema["timeline_json"][1]["multiline"] is True
|
assert schema["timeline_json"][1]["multiline"] is True
|
||||||
result = DumasH3SequencePromptBuilder().build(1, 4, "Directive", json.dumps(default_sequence(1, 4)), "N/A", "N/A")
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user