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 } })