Post stillId with video generate and do not queue I2V behind a phantom busy job.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-28 17:37:03 -05:00
co-authored by Cursor
parent b48531d3c2
commit 2171ad3b44
3 changed files with 150 additions and 32 deletions
+24 -3
View File
@@ -1,3 +1,4 @@
import { existsSync, readFileSync } from 'node:fs'
import { addStudioJob, kickStudioQueue, listStudioJobs } from '~/server/utils/studioQueue'
import { listStudioLoras, parsePostedLoraStack, parseShotLoraStacks, persistLoraFields } from '~/server/utils/loras'
import type { LoraStackItem } from '~/utils/loras'
@@ -112,6 +113,27 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: LTX_DISABLED_MESSAGE })
}
const textToVideo = isTextToVideo(workflow)
const ownerKey = libraryOwnerKey(event)
const postedStillId = (fields.stillId || '').trim()
let libraryStill: { id: string; filename: string } | null = null
if (postedStillId) {
const path = stillPath(ownerKey, postedStillId)
if (existsSync(path)) {
try {
const existing = getStill(ownerKey, postedStillId)
libraryStill = { id: existing.id, filename: existing.filename }
if (!image) {
image = {
filename: existing.filename || 'still.png',
data: readFileSync(path),
type: 'image/png'
}
}
} catch {
libraryStill = null
}
}
}
if (!image && !textToVideo) {
throw createError({ statusCode: 400, statusMessage: 'An initial image is required' })
}
@@ -158,7 +180,6 @@ export default defineEventHandler(async (event) => {
const hideInput = fields.hideInput === 'true'
const sound = !isLtxWorkflow(workflow) && fields.sound !== 'false'
const clipName = (fields.name || '').trim().slice(0, 80)
const ownerKey = libraryOwnerKey(event)
const library = publicLibrary(event)
const folderId = library.folders.some(folder => folder.id === fields.folderId)
? fields.folderId
@@ -169,7 +190,7 @@ export default defineEventHandler(async (event) => {
const destFolder = library.folders.find(folder => folder.id === folderId)
const folderLocked = Boolean(destFolder?.protected && !destFolder.unlocked)
assertFolderExists(event, folderId)
const still = image
const still = libraryStill || (image
? await rememberInputStill({
ownerKey,
folderId,
@@ -179,7 +200,7 @@ export default defineEventHandler(async (event) => {
height,
hideInput
})
: null
: null)
const referenceStillIds: Array<string | null> = [null, null, null, null]
if (useIdentityRefs) {
for (const [index, ref] of referenceImages.entries()) {