Files
aigen/server/api/interrupt.post.ts
T
TowstyandCursor f54e8da857 Let image edit run while video Comfy is busy.
Split video/edit job state so the sidecar can edit concurrently, and hide v2 identity-ref thumbnails when the input still is hidden.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-26 14:44:56 -05:00

20 lines
722 B
TypeScript

export default defineEventHandler(async (event) => {
const body = await readBody<{ jobId?: string; kind?: string }>(event).catch(() => ({}))
const jobId = String(body?.jobId || '')
const job = jobId ? getJob(jobId) : undefined
if (job) {
job.status = 'cancelled'
emitJob(job, { type: 'status', message: 'Cancelling job...' })
removeExtendTemp(job.library?.extendTmpDir)
}
if (jobId) deletePendingJob(jobId)
const kind = job?.kind || (body?.kind === 'edit' ? 'edit' : 'video')
const ok = kind === 'edit'
? await interruptImageComfy()
: await interruptComfy()
if (job) {
emitJob(job, { type: 'error', error: 'Job interrupted.', message: 'Job interrupted.' })
}
return { ok }
})