Keep queueing video extensions while a clip is already generating.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -66,6 +66,7 @@ export interface StudioJobPayload {
|
||||
maskStillId?: string
|
||||
maskStillFilename?: string
|
||||
refineStrength?: number
|
||||
extendFromClipId?: string
|
||||
}
|
||||
|
||||
export interface StudioJob {
|
||||
@@ -897,11 +898,44 @@ async function startStudioEditJob(item: StudioJob) {
|
||||
}
|
||||
}
|
||||
|
||||
async function startStudioExtendJob(item: StudioJob) {
|
||||
let live: Job | undefined
|
||||
try {
|
||||
const { beginExtendFromClip } = await import('~/server/utils/extendChain')
|
||||
live = await beginExtendFromClip({
|
||||
ownerKey: item.ownerKey,
|
||||
clipId: String(item.payload.extendFromClipId || ''),
|
||||
prompt: item.payload.prompt,
|
||||
promptPre: item.payload.promptPre,
|
||||
promptPost: item.payload.promptPost,
|
||||
duration: item.payload.duration,
|
||||
loraStack: item.payload.loraStack || item.payload.loraName,
|
||||
folderLocked: item.payload.folderLocked
|
||||
})
|
||||
await markStudioLive(item.ownerKey, item.id, live.id)
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
if (live && (live.status === 'queued' || live.status === 'uploading' || live.status === 'running')) {
|
||||
live.status = 'error'
|
||||
live.error = message
|
||||
}
|
||||
await patchStudioJob(item.ownerKey, item.id, (job) => {
|
||||
job.status = 'error'
|
||||
job.lastError = message
|
||||
}).catch(() => null)
|
||||
kickStudioQueue()
|
||||
}
|
||||
}
|
||||
|
||||
export async function startStudioJob(item: StudioJob) {
|
||||
if (studioJobKind(item) === 'edit') {
|
||||
await startStudioEditJob(item)
|
||||
return
|
||||
}
|
||||
if (item.payload.extendFromClipId) {
|
||||
await startStudioExtendJob(item)
|
||||
return
|
||||
}
|
||||
let live: Job | undefined
|
||||
try {
|
||||
const { createJob } = await import('~/server/utils/jobs')
|
||||
|
||||
Reference in New Issue
Block a user