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>
22 lines
614 B
TypeScript
22 lines
614 B
TypeScript
import { checkComfyHttp, fetchQueue } from '~/server/utils/comfyLifecycle'
|
|
|
|
export default defineEventHandler(async () => {
|
|
const [comfy, queue] = await Promise.all([
|
|
checkComfyHttp().catch(() => ({ ok: false, host: '', stats: null })),
|
|
fetchQueue()
|
|
])
|
|
const busy = Boolean(comfy.ok && queue.running > 0)
|
|
return {
|
|
ok: true,
|
|
service: useRuntimeConfig().public.instanceName || 'aigen',
|
|
comfy: {
|
|
ok: comfy.ok,
|
|
busy,
|
|
host: comfy.host || '',
|
|
queueRunning: queue.running,
|
|
queuePending: queue.pending,
|
|
stats: comfy.ok ? comfy.stats : undefined
|
|
}
|
|
}
|
|
})
|