Headless image-to-video UI queues jobs on the desktop ComfyUI instance with live SSE progress and Authentik SSO.
14 lines
464 B
TypeScript
14 lines
464 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const body = await readBody<{ jobId?: string }>(event).catch(() => ({}))
|
|
const job = body?.jobId ? getJob(body.jobId) : undefined
|
|
if (job) {
|
|
job.status = 'cancelled'
|
|
emitJob(job, { type: 'status', message: 'Cancelling job...' })
|
|
}
|
|
const ok = await interruptComfy()
|
|
if (job) {
|
|
emitJob(job, { type: 'error', error: 'Job interrupted.', message: 'Job interrupted.' })
|
|
}
|
|
return { ok }
|
|
})
|