Keep a generation log so wiped or failed jobs can be re-queued.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-03 16:15:09 -05:00
co-authored by Cursor
parent b5014f02b4
commit 88c5d25b78
10 changed files with 421 additions and 18 deletions
+26 -9
View File
@@ -2227,7 +2227,7 @@ import {
VIDEO_CFG_STEP,
type GenerationPreset
} from '~/utils/generationPresets'
import { LOAD_QUEUED_JOB_KEY } from '~/utils/queuedJob'
import { LOAD_GENERATION_PAYLOAD_KEY, LOAD_QUEUED_JOB_KEY } from '~/utils/queuedJob'
import {
clipSettingsRows,
inferStillPipeline,
@@ -4400,6 +4400,19 @@ function applyIncomingDirectorScript() {
}
async function applyIncomingQueuedJob() {
try {
const raw = sessionStorage.getItem(LOAD_GENERATION_PAYLOAD_KEY)
if (raw) {
sessionStorage.removeItem(LOAD_GENERATION_PAYLOAD_KEY)
const loaded = JSON.parse(raw) as { kind?: string; payload?: Record<string, any> }
if (loaded?.payload) {
await restoreStudioPayload(loaded.kind || 'video', loaded.payload)
toast('Saved generation loaded into Input.')
return
}
}
} catch { /* fall through to queue id */ }
let id = ''
try {
id = sessionStorage.getItem(LOAD_QUEUED_JOB_KEY) || ''
@@ -5376,7 +5389,16 @@ async function restoreStudioEditJob(payload: {
async function restoreStudioJob(id: string) {
const job = await $fetch<{
payload?: {
payload?: Parameters<typeof restoreStudioPayload>[1]
kind?: string
imagePipeline?: string
}>(`/api/studio-queue/${id}`)
const payload = job.payload
if (!payload) throw new Error('That job has no saved inputs')
await restoreStudioPayload(job.kind || (payload.imagePipeline === 'v2' ? 'edit' : 'video'), payload)
}
async function restoreStudioPayload(kind: string, payload: {
prompt?: string
name?: string
folderId?: string
@@ -5423,13 +5445,8 @@ async function restoreStudioJob(id: string) {
scaleMegapixels?: number
steps?: number
referenceStillId?: string
}
kind?: string
imagePipeline?: string
}>(`/api/studio-queue/${id}`)
const payload = job.payload
if (!payload) throw new Error('That job has no saved inputs')
if (job.kind === 'edit' || payload.imagePipeline === 'v2') {
}) {
if (kind === 'edit' || payload.imagePipeline === 'v2') {
await restoreStudioEditJob(payload)
return
}