From 36db1f90c94da3833efc4d55d0cac8dd13920198 Mon Sep 17 00:00:00 2001 From: Benjiyaya Date: Sat, 29 Aug 2026 05:17:35 +0800 Subject: [PATCH] feat: video-stage continue validator and clip picker --- calliope-web/src/lib/api.ts | 2 - calliope-web/src/lib/comfy/classifyInput.ts | 5 - calliope-web/src/lib/comfy/parser.ts | 1 - calliope-web/src/lib/comfy/types.ts | 2 - .../src/lib/components/OmniComposer.svelte | 11 +- .../src/lib/components/QueueStage.svelte | 101 ++++++++----- .../settings/WorkflowsLibrary.svelte | 14 -- .../video/VideoEditWorkspace.svelte | 140 ++++++++++++++---- 8 files changed, 186 insertions(+), 90 deletions(-) diff --git a/calliope-web/src/lib/api.ts b/calliope-web/src/lib/api.ts index b59fe2ba..e2784343 100644 --- a/calliope-web/src/lib/api.ts +++ b/calliope-web/src/lib/api.ts @@ -235,7 +235,6 @@ export const workflows = { inputs: ComfyDynamicInput[]; outputs: ComfyDynamicOutput[]; suggested_profile?: string; - motion_role?: 'first' | 'next' | null; }>('/api/workflows/analyze', { method: 'POST', body: JSON.stringify({ workflow_json }), @@ -275,7 +274,6 @@ export const jobsApi = { scene_ids?: number[]; workflow_id?: number; input_values?: Record; - continue_motion?: boolean; } = {}, ) => api<{ ok: boolean; jobs: Job[] }>(`/api/jobs/projects/${projectId}/generate-videos`, { diff --git a/calliope-web/src/lib/comfy/classifyInput.ts b/calliope-web/src/lib/comfy/classifyInput.ts index 5047bc35..62091644 100644 --- a/calliope-web/src/lib/comfy/classifyInput.ts +++ b/calliope-web/src/lib/comfy/classifyInput.ts @@ -49,11 +49,6 @@ export function classifyInput(inp: ComfyDynamicInput): ClassifiedInput { return { input: inp, zone: 'composer', widget: 'negativeTextarea' }; } - // Timeline-owned — filled on enqueue, never a user widget. - if (role === 'clipindex') { - return { input: inp, zone: 'hidden', widget: 'numberPill' }; - } - // --- Media tray --- if ( role === 'character' || diff --git a/calliope-web/src/lib/comfy/parser.ts b/calliope-web/src/lib/comfy/parser.ts index f1bed7ff..a4609705 100644 --- a/calliope-web/src/lib/comfy/parser.ts +++ b/calliope-web/src/lib/comfy/parser.ts @@ -29,7 +29,6 @@ const INPUT_ROLE_ALIASES: Record = { image: ['image', 'img'], video: ['video', 'vid'], audio: ['audio', 'sound', 'sfx'], - clipindex: ['clipindex', 'clip_index'], seed: ['seed'], duration: ['duration', 'dur', 'length', 'seconds'], }; diff --git a/calliope-web/src/lib/comfy/types.ts b/calliope-web/src/lib/comfy/types.ts index f8ff6968..fc1a843d 100644 --- a/calliope-web/src/lib/comfy/types.ts +++ b/calliope-web/src/lib/comfy/types.ts @@ -35,8 +35,6 @@ export interface Workflow { description: string | null; prompt_profile: string; is_enabled: boolean; - /** H3 Motion Context pair: FirstMotion vs NextMotion. */ - motion_role?: 'first' | 'next' | null; } export interface Job { diff --git a/calliope-web/src/lib/components/OmniComposer.svelte b/calliope-web/src/lib/components/OmniComposer.svelte index fd868523..e8a1a4da 100644 --- a/calliope-web/src/lib/components/OmniComposer.svelte +++ b/calliope-web/src/lib/components/OmniComposer.svelte @@ -48,6 +48,10 @@ onSubmit?: () => void; /** Pending state for the Generate button (shows spinner-ish label). */ submitting?: boolean; + /** Disable the Generate button (e.g. workflow cannot fulfil the scene). */ + disabled?: boolean; + /** Why Generate is disabled — surfaced as the button's title tooltip. */ + generateDisabledHint?: string; /** Custom label for the Generate button. */ generateLabel?: string; } @@ -65,6 +69,8 @@ onChange, onSubmit, submitting = false, + disabled = false, + generateDisabledHint = '', generateLabel = 'Generate', }: Props = $props(); @@ -355,8 +361,9 @@ @@ -536,6 +539,13 @@ {@const selWf = workflowFor(selected)} {@const selStatus = statusOf(selected)} {@const selPreview = previewPath(selected)} + {@const selHasVideoInput = workflowHasVideoInput(selWf)} + {@const selVideoNode = videoInputNodeFor(selWf)} + {@const selClips = timelineClipOptions(selected)} + {@const selChain = Boolean(selected.chain_from_prev)} + {@const selSource = clipSource[selected.id] ?? 'auto'} + {@const selSourceValid = selSource === 'auto' || selSource === 'upload' || selClips.some((s) => String(s.id) === selSource)} + {@const selBlocked = selChain && !selHasVideoInput} { - continueByScene = { ...continueByScene, [selected.id]: on }; + chained={(scene) => Boolean(scene.chain_from_prev)} + generateDisabled={selBlocked} + generateDisabledReason={selBlocked + ? 'This scene continues from the previous video — pick a workflow with a video input' + : ''} + clipSource={{ + enabled: selChain && selHasVideoInput && Boolean(selVideoNode), + value: selSourceValid ? selSource : 'auto', + options: selClips.map((s) => ({ id: String(s.id), label: `#${s.order_index} ${s.heading || 'Scene'}` })), + }} + onClipSourceChange={(val) => { + if (val === 'auto') { + // Back to Auto: send nothing — the backend resolves the previous clip. + const next = { ...clipSource }; + delete next[selected.id]; + clipSource = next; + if (selVideoNode) formValues = { ...formValues, [selVideoNode.nodeId]: '' }; + } else if (val === 'upload') { + clipSource = { ...clipSource, [selected.id]: 'upload' }; + } else { + clipSource = { ...clipSource, [selected.id]: val }; + const clip = selClips.find((s) => String(s.id) === val); + if (clip?.video_path && selVideoNode) { + formValues = { ...formValues, [selVideoNode.nodeId]: clip.video_path }; + } + } }} onSelect={selectScene} onStep={step} @@ -589,13 +620,13 @@ {#if exportStale}
- Clips changed since this export — re-export to update. + Clips changed since this export — re-export to update.
{/if} {:else if exportState === 'active'}
-

Exporting your film…

+

Exporting your film…

-

You can keep editing — export runs in the background.

+

You can keep editing — export runs in the background.

{:else if exportState === 'failed'} @@ -630,7 +661,7 @@

Your film isn't exported yet

- {clipsReady} clips · {formatClock(totalSec)} · 0.5s crossfades · loudness matched + {clipsReady} clips · {formatClock(totalSec)} · 0.5s crossfades · loudness matched

{#if clipsMissing > 0}

@@ -657,7 +688,7 @@ {@const exportUrl = assetUrl(exportPath)}

- {exportClipCount} clips · {formatClock(totalSec)}{#if exportedAgo} · Exported {exportedAgo}{/if} + {exportClipCount} clips · {formatClock(totalSec)}{#if exportedAgo} · Exported {exportedAgo}{/if}
{#if exportUrl} @@ -686,7 +717,7 @@