Held jobs restore the form after a 3-minute wait, hidden stills stay blurred in the picker, and reloading Comfy no longer leaves xaigen spinning. Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
532 B
TypeScript
16 lines
532 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const body = await readBody<{ jobId?: 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...' })
|
|
}
|
|
if (jobId) deletePendingJob(jobId)
|
|
const ok = await interruptComfy()
|
|
if (job) {
|
|
emitJob(job, { type: 'error', error: 'Job interrupted.', message: 'Job interrupted.' })
|
|
}
|
|
return { ok }
|
|
})
|