Derive external timeline duration from sections

This commit is contained in:
OpenClaw Agent
2026-07-20 09:17:04 +00:00
parent 8736d4a463
commit e01ceef71b
3 changed files with 13 additions and 20 deletions

View File

@@ -177,11 +177,10 @@ def _build_runtime_timeline_payload(external_timeline, frame_rate: float) -> tup
return tdata, "", "", 0.0, 0
sections = external_timeline.get("sections") or []
duration_seconds = max(0.1, float(external_timeline.get("duration") or 0.0))
duration_frames = max(1, int(round(duration_seconds * frame_rate)))
current_start = 0
local_prompts = []
segment_lengths = []
total_duration_seconds = 0.0
for index, section in enumerate(sections):
if not isinstance(section, dict):
@@ -191,6 +190,7 @@ def _build_runtime_timeline_payload(external_timeline, frame_rate: float) -> tup
continue
section_seconds = max(0.1, float(section.get("duration") or 0.0))
section_frames = max(1, int(round(section_seconds * frame_rate)))
total_duration_seconds += section_seconds
seg = {
"id": f"external_{index}",
"start": current_start,
@@ -205,6 +205,8 @@ def _build_runtime_timeline_payload(external_timeline, frame_rate: float) -> tup
segment_lengths.append(str(section_frames))
current_start += section_frames
duration_seconds = max(0.1, float(total_duration_seconds or external_timeline.get("duration") or 0.0))
duration_frames = max(1, int(round(duration_seconds * frame_rate)))
return tdata, " | ".join(local_prompts), ",".join(segment_lengths), duration_seconds, duration_frames