Keep remaining multi-shot clips on a Queue page so prompts can be edited between shots, with process-next or overnight run-all.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+11
-3
@@ -2,7 +2,8 @@ import { existsSync } from 'node:fs'
|
||||
import type { Job, JobEvent } from '~/server/utils/jobs'
|
||||
import { getJob, restoreJob } from '~/server/utils/jobs'
|
||||
import type { PendingJob } from '~/server/utils/pending'
|
||||
import { isLastChainShot, libraryFromPending, pendingFromJob, writePendingJob, deletePendingJob } from '~/server/utils/pending'
|
||||
import { isLastChainShot, libraryFromPending, pendingFromJob, remainingAfterCurrentShot, writePendingJob, deletePendingJob } from '~/server/utils/pending'
|
||||
import { syncQueueFromJob } from '~/server/utils/shotQueue'
|
||||
|
||||
function classifyError(message: string) {
|
||||
const lower = message.toLowerCase()
|
||||
@@ -132,6 +133,7 @@ export function watchComfyJob(job: Job, options: { persist?: boolean } = {}): Pr
|
||||
job.status = job.status === 'cancelled' ? 'cancelled' : 'error'
|
||||
job.error = classifyError(error)
|
||||
emitChainJob(job, { type: 'error', error: job.error, message: job.error })
|
||||
await syncQueueFromJob(job).catch(() => null)
|
||||
if (job.id) deletePendingJob(job.id)
|
||||
removeExtendTemp(job.library?.extendTmpDir)
|
||||
await purgeComfyArtifacts({
|
||||
@@ -212,6 +214,7 @@ export function watchComfyJob(job: Job, options: { persist?: boolean } = {}): Pr
|
||||
job.library.thumb = undefined
|
||||
job.library.name = nextClipPartName(clip.name)
|
||||
job.library.parentClipId = clip.id
|
||||
await syncQueueFromJob(job, clip.id).catch(() => null)
|
||||
await purgeComfyArtifacts({
|
||||
video,
|
||||
imageName: job.library.imageName,
|
||||
@@ -242,11 +245,14 @@ export function watchComfyJob(job: Job, options: { persist?: boolean } = {}): Pr
|
||||
job.library.extendTmpDir = undefined
|
||||
}
|
||||
job.status = 'complete'
|
||||
const queuedRemaining = job.library ? remainingAfterCurrentShot(job.library).length : 0
|
||||
emitJob(job, {
|
||||
type: 'complete',
|
||||
message: job.library?.folderLocked
|
||||
? 'Saved to the locked folder. Unlock it to view.'
|
||||
: (job.library?.extendSourceClipId || (job.library?.chainTotal || 1) > 1 ? 'Extended video ready' : 'Video ready'),
|
||||
: queuedRemaining > 0
|
||||
? `Shot ${chainMeta(job).step} of ${chainMeta(job).total} saved. ${queuedRemaining} remaining on Queue.`
|
||||
: (job.library?.extendSourceClipId || (job.library?.chainTotal || 1) > 1 ? 'Extended video ready' : 'Video ready'),
|
||||
progress: 100,
|
||||
filename: job.library?.folderLocked ? undefined : video.filename,
|
||||
subfolder: job.library?.folderLocked ? undefined : video.subfolder,
|
||||
@@ -256,7 +262,9 @@ export function watchComfyJob(job: Job, options: { persist?: boolean } = {}): Pr
|
||||
folderLocked: job.library?.folderLocked,
|
||||
chainStep: job.library?.chainStep,
|
||||
chainTotal: job.library?.chainTotal,
|
||||
chainLabel: job.library?.chainLabel
|
||||
chainLabel: job.library?.chainLabel,
|
||||
queuedRemaining,
|
||||
queueId: job.library?.queueId
|
||||
})
|
||||
deletePendingJob(job.id)
|
||||
job.saving = false
|
||||
|
||||
Reference in New Issue
Block a user