|
|
|
@ -366,10 +366,6 @@ export function GenerateVideoNodeView({ id, data, selected }: GenerateVideoNodeV |
|
|
|
[id, modelOptions, nodeData, updateNodeData] |
|
|
|
); |
|
|
|
|
|
|
|
const handleClearVideo = useCallback(() => { |
|
|
|
updateNodeData(id, { outputVideo: null, status: "idle", error: null }); |
|
|
|
}, [id, updateNodeData]); |
|
|
|
|
|
|
|
const handleParametersChange = useCallback( |
|
|
|
(parameters: Record<string, unknown>) => { |
|
|
|
updateNodeData(id, buildGenerationParametersPatch(nodeConfig, parameters)); |
|
|
|
@ -441,6 +437,59 @@ export function GenerateVideoNodeView({ id, data, selected }: GenerateVideoNodeV |
|
|
|
} |
|
|
|
}, [generationsPath]); |
|
|
|
|
|
|
|
const handleClearVideo = useCallback(async () => { |
|
|
|
const history = nodeData.videoHistory || []; |
|
|
|
if (history.length === 0) { |
|
|
|
updateNodeData(id, { |
|
|
|
outputVideo: null, |
|
|
|
outputVideoRef: undefined, |
|
|
|
outputVideoRemoteUrl: undefined, |
|
|
|
outputVideoRemoteExpiresAt: undefined, |
|
|
|
outputVideoStorageStatus: undefined, |
|
|
|
videoHistory: [], |
|
|
|
selectedVideoHistoryIndex: 0, |
|
|
|
status: "idle", |
|
|
|
error: null, |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const currentIndex = Math.min(Math.max(nodeData.selectedVideoHistoryIndex || 0, 0), history.length - 1); |
|
|
|
const nextHistory = history.filter((_, index) => index !== currentIndex); |
|
|
|
if (nextHistory.length === 0) { |
|
|
|
updateNodeData(id, { |
|
|
|
outputVideo: null, |
|
|
|
outputVideoRef: undefined, |
|
|
|
outputVideoRemoteUrl: undefined, |
|
|
|
outputVideoRemoteExpiresAt: undefined, |
|
|
|
outputVideoStorageStatus: undefined, |
|
|
|
videoHistory: [], |
|
|
|
selectedVideoHistoryIndex: 0, |
|
|
|
status: "idle", |
|
|
|
error: null, |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const nextIndex = Math.min(currentIndex, nextHistory.length - 1); |
|
|
|
const nextItem = nextHistory[nextIndex]; |
|
|
|
setIsLoadingCarouselVideo(true); |
|
|
|
const nextVideo = nextItem.video ?? await loadVideoById(nextItem.id); |
|
|
|
setIsLoadingCarouselVideo(false); |
|
|
|
|
|
|
|
updateNodeData(id, { |
|
|
|
outputVideo: nextVideo, |
|
|
|
outputVideoRef: undefined, |
|
|
|
outputVideoRemoteUrl: nextVideo && /^https?:\/\//i.test(nextVideo) ? nextVideo : undefined, |
|
|
|
outputVideoRemoteExpiresAt: undefined, |
|
|
|
outputVideoStorageStatus: nextVideo && /^https?:\/\//i.test(nextVideo) ? "remote-only" : undefined, |
|
|
|
videoHistory: nextHistory, |
|
|
|
selectedVideoHistoryIndex: nextIndex, |
|
|
|
status: "idle", |
|
|
|
error: nextVideo ? null : "Selected video could not be loaded", |
|
|
|
}); |
|
|
|
}, [id, loadVideoById, nodeData.selectedVideoHistoryIndex, nodeData.videoHistory, updateNodeData]); |
|
|
|
|
|
|
|
// Carousel navigation handlers
|
|
|
|
const handleCarouselPrevious = useCallback(async () => { |
|
|
|
const history = nodeData.videoHistory || []; |
|
|
|
|