|
|
@ -619,19 +619,6 @@ function isVideoHandle(handleId: string | null | undefined): boolean { |
|
|
return handleId === "video" || handleId.startsWith("video-") || handleId.includes("video"); |
|
|
return handleId === "video" || handleId.startsWith("video-") || handleId.includes("video"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getConnectedVideoDurationSeconds( |
|
|
|
|
|
targetNodeId: string, |
|
|
|
|
|
nodes: WorkflowNode[], |
|
|
|
|
|
edges: Array<{ source: string; target: string; sourceHandle?: string | null; targetHandle?: string | null }> |
|
|
|
|
|
): number { |
|
|
|
|
|
const videoEdge = edges.find((edge) => |
|
|
|
|
|
edge.target === targetNodeId && |
|
|
|
|
|
(isVideoHandle(edge.targetHandle) || isVideoHandle(edge.sourceHandle)) |
|
|
|
|
|
); |
|
|
|
|
|
if (!videoEdge) return 0; |
|
|
|
|
|
return getNodeVideoDurationSeconds(nodes.find((node) => node.id === videoEdge.source)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getConnectedVideoDurationList( |
|
|
function getConnectedVideoDurationList( |
|
|
targetNodeId: string, |
|
|
targetNodeId: string, |
|
|
nodes: WorkflowNode[], |
|
|
nodes: WorkflowNode[], |
|
|
@ -1168,16 +1155,18 @@ export function GenerationComposer() { |
|
|
return getConnectedInputs(context.node.id); |
|
|
return getConnectedInputs(context.node.id); |
|
|
}, [context, getConnectedInputs, nodes, edges, dimmedNodeIds]); |
|
|
}, [context, getConnectedInputs, nodes, edges, dimmedNodeIds]); |
|
|
|
|
|
|
|
|
const connectedVideoDurationSeconds = useMemo(() => { |
|
|
|
|
|
if (context.mode !== "node-edit" || !context.node) return 0; |
|
|
|
|
|
return getConnectedVideoDurationSeconds(context.node.id, nodes, edges); |
|
|
|
|
|
}, [context, edges, nodes]); |
|
|
|
|
|
|
|
|
|
|
|
const connectedVideoDurations = useMemo(() => { |
|
|
const connectedVideoDurations = useMemo(() => { |
|
|
if (context.mode !== "node-edit" || !context.node) return []; |
|
|
if (context.mode !== "node-edit" || !context.node) return []; |
|
|
return getConnectedVideoDurationList(context.node.id, nodes, edges); |
|
|
return getConnectedVideoDurationList(context.node.id, nodes, edges); |
|
|
}, [context, edges, nodes]); |
|
|
}, [context, edges, nodes]); |
|
|
|
|
|
|
|
|
|
|
|
const connectedVideoDurationSeconds = useMemo(() => { |
|
|
|
|
|
const totalDuration = connectedVideoDurations.reduce((sum, duration) => { |
|
|
|
|
|
return Number.isFinite(duration) && duration > 0 ? sum + duration : sum; |
|
|
|
|
|
}, 0); |
|
|
|
|
|
return Math.ceil(totalDuration); |
|
|
|
|
|
}, [connectedVideoDurations]); |
|
|
|
|
|
|
|
|
const estimatedReferenceImageCount = context.mode === "node-edit" && (connectedInputs?.images.length ?? 0) > 0 |
|
|
const estimatedReferenceImageCount = context.mode === "node-edit" && (connectedInputs?.images.length ?? 0) > 0 |
|
|
? connectedInputs?.images.length ?? 0 |
|
|
? connectedInputs?.images.length ?? 0 |
|
|
: draft.inputImages.length; |
|
|
: draft.inputImages.length; |
|
|
|