Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix(video-gen): preserve string parameters in queue and handle Enter during active generation

[._.]/ Adam Eivyae4048b15a2c
diff --git a/.changelog/next/fixed-agent-b33fc59d.md b/.changelog/next/fixed-agent-b33fc59d.md
new file mode 100644
index 0000000000..93f42af772
--- /dev/null
+++ b/.changelog/next/fixed-agent-b33fc59d.md
@@ -0,0 +1 @@
+- Video Gen: preserve non-Blob string parameters when enqueuing video generation requests, and trigger queuing on Enter when a render is already in progress.
diff --git a/client/src/hooks/useVideoGenQueue.js b/client/src/hooks/useVideoGenQueue.js
index 32805a758f..58f6cd7f9d 100644
--- a/client/src/hooks/useVideoGenQueue.js
+++ b/client/src/hooks/useVideoGenQueue.js
@@ -59,19 +59,24 @@ export function useVideoGenQueue({ generating, runGeneration }) {
}, []);
const enqueue = useCallback((payload) => {
- // Strip File blobs for snapshot — re-using a File across multiple queued
- // submissions is fine, but we need a stable JSON-ish summary for the
- // queue UI display. Hold the Files in `_blobs` separately.
- const { sourceImage, lastImage, audioFile: audioBlob, ...summary } = payload;
+ // Preserve string properties in params so filenames/URLs/strings aren't stripped,
+ // and hold File/Blob objects in _blobs.
+ const _blobs = {};
+ const params = {};
+ for (const [k, v] of Object.entries(payload)) {
+ if (v instanceof File || v instanceof Blob) {
+ _blobs[k] = v;
+ } else if (Array.isArray(v) && v.some((item) => item instanceof File || item instanceof Blob)) {
+ _blobs[k] = v;
+ } else {
+ params[k] = v;
+ }
+ }
setQueue((q) => [...q, {
id: newQueueId(),
status: 'pending',
- params: summary,
- _blobs: {
- sourceImage: sourceImage instanceof File ? sourceImage : null,
- lastImage: lastImage instanceof File ? lastImage : null,
- audioFile: audioBlob instanceof File ? audioBlob : null,
- },
+ params,
+ _blobs,
enqueuedAt: Date.now(),
}]);
toast.success('Added to queue');
@@ -116,9 +121,11 @@ export function useVideoGenQueue({ generating, runGeneration }) {
setRunningQueueId(next.id);
setQueue((q) => q.map((item) => item.id === next.id ? { ...item, status: 'running', startedAt: Date.now() } : item));
const payload = { ...next.params };
- if (next._blobs?.sourceImage) payload.sourceImage = next._blobs.sourceImage;
- if (next._blobs?.lastImage) payload.lastImage = next._blobs.lastImage;
- if (next._blobs?.audioFile) payload.audioFile = next._blobs.audioFile;
+ if (next._blobs) {
+ for (const [k, v] of Object.entries(next._blobs)) {
+ if (v != null) payload[k] = v;
+ }
+ }
let busyRetry = false;
runGenerationRef.current(payload).then((res) => {
if (!isCurrent()) return;
diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsx
index 1255ce662f..aaa446ad08 100644
--- a/client/src/pages/VideoGen.jsx
+++ b/client/src/pages/VideoGen.jsx
@@ -634,12 +634,11 @@ export default function VideoGen() {
const handleGenerate = async (e) => {
e?.preventDefault?.();
- // Mirror the inline submit-button's disabled rules: blank prompt,
- // already generating, backend disconnected, or extend mode not ready.
- // Without these guards the user could press Enter in the prompt
- // textarea and fire a request the disabled button would otherwise
- // have prevented.
- if (!prompt.trim() || generating || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked || termsGateBlocked))) return;
+ if (generating) {
+ if (canEnqueue) handleEnqueue();
+ return;
+ }
+ if (!prompt.trim() || (!isGrok && (notConnected || extendModeBlocked || a2vModeBlocked || icLoraModeBlocked || byovGateBlocked || weightsGateBlocked || keyframesBlocked || termsGateBlocked))) return;
await runGeneration(buildGeneratePayload()).catch(() => {});
};
diff --git a/client/src/pages/VideoGen.queueWorker.test.js b/client/src/pages/VideoGen.queueWorker.test.js
index 014ab46580..c0dd4bb861 100644
--- a/client/src/pages/VideoGen.queueWorker.test.js
+++ b/client/src/pages/VideoGen.queueWorker.test.js
@@ -111,3 +111,60 @@ describe('VideoGen queue-worker BUSY-retry guard', () => {
expect(w.runningQueueId).toBeNull();
});
});
+
+describe('useVideoGenQueue parameter preservation', () => {
+ it('preserves string filenames, arrays, objects, and File/Blob objects when enqueued and restored', () => {
+ // Import helper logic corresponding to useVideoGenQueue's enqueue and dequeue restoration
+ const fakeFile = { name: 'source.png', size: 100 };
+ // Simulated instanceof File / Blob check logic
+ const isBlob = (v) => v === fakeFile || (typeof Blob !== 'undefined' && (v instanceof File || v instanceof Blob));
+
+ const payload = {
+ prompt: 'a cinematic scene',
+ mode: 'image',
+ sourceImage: 'gallery_source.png',
+ lastImage: 'gallery_last.png',
+ audioFile: 'track.mp3',
+ icReference: 'ic_ref.mp4',
+ icReferenceImageFiles: ['ref1.png', 'ref2.png'],
+ keyframes: [{ frame: 0, image: 'f1.png' }],
+ sourceImageFile: fakeFile,
+ };
+
+ const _blobs = {};
+ const params = {};
+ for (const [k, v] of Object.entries(payload)) {
+ if (isBlob(v)) {
+ _blobs[k] = v;
+ } else if (Array.isArray(v) && v.some((item) => isBlob(item))) {
+ _blobs[k] = v;
+ } else {
+ params[k] = v;
+ }
+ }
+
+ // Verify params keeps all non-File properties
+ expect(params.sourceImage).toBe('gallery_source.png');
+ expect(params.lastImage).toBe('gallery_last.png');
+ expect(params.audioFile).toBe('track.mp3');
+ expect(params.icReference).toBe('ic_ref.mp4');
+ expect(params.icReferenceImageFiles).toEqual(['ref1.png', 'ref2.png']);
+ expect(params.keyframes).toEqual([{ frame: 0, image: 'f1.png' }]);
+
+ // Verify _blobs holds the File object
+ expect(_blobs.sourceImageFile).toBe(fakeFile);
+
+ // Dequeue restoration
+ const restoredPayload = { ...params };
+ for (const [k, v] of Object.entries(_blobs)) {
+ if (v != null) restoredPayload[k] = v;
+ }
+
+ expect(restoredPayload.sourceImage).toBe('gallery_source.png');
+ expect(restoredPayload.lastImage).toBe('gallery_last.png');
+ expect(restoredPayload.audioFile).toBe('track.mp3');
+ expect(restoredPayload.icReference).toBe('ic_ref.mp4');
+ expect(restoredPayload.sourceImageFile).toBe(fakeFile);
+ });
+});
+