Start ComfyUI automatically before queueing MiniMax jobs.
Health-check /system_stats, wait if the desktop is booting or busy, and start the host instance when it is fully offline. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -71,7 +71,7 @@ export default defineEventHandler(async (event) => {
|
||||
seed,
|
||||
thumb: image.data
|
||||
}
|
||||
emitJob(job, { type: 'status', message: 'Uploading image...', progress: 2 })
|
||||
emitJob(job, { type: 'status', message: 'Checking ComfyUI...', progress: 1 })
|
||||
|
||||
void runGeneration(job, { prompt, image, width, height, steps, seed, turbo, length }).catch((error) => {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
@@ -107,8 +107,20 @@ async function runGeneration(
|
||||
length: number
|
||||
}
|
||||
) {
|
||||
await ensureComfyReady((status) => {
|
||||
emitJob(job, {
|
||||
type: status.state === 'busy' ? 'busy' : 'status',
|
||||
message: status.message,
|
||||
progress: status.state === 'online' ? Math.max(job.progress, 3) : Math.max(job.progress, 1),
|
||||
busy: status.state === 'busy',
|
||||
queueRunning: status.queueRunning,
|
||||
queuePending: status.queuePending
|
||||
})
|
||||
})
|
||||
|
||||
const done = watchComfyJob(job)
|
||||
job.status = 'uploading'
|
||||
emitJob(job, { type: 'status', message: 'Uploading image to ComfyUI...', progress: 4 })
|
||||
const uploaded = await uploadImage(params.image)
|
||||
if (job.library) job.library.imageName = uploaded.name
|
||||
emitJob(job, { type: 'status', message: 'Queueing MiniMax H3 job...', progress: 6 })
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
export default defineEventHandler(async () => {
|
||||
const comfy = await probeComfy().catch(() => ({ ok: false, host: '' }))
|
||||
const comfy = await checkComfyHttp().catch(() => ({ ok: false, host: '', stats: null }))
|
||||
return {
|
||||
ok: true,
|
||||
service: useRuntimeConfig().public.instanceName || 'aigen',
|
||||
comfy
|
||||
comfy: {
|
||||
ok: comfy.ok,
|
||||
host: comfy.host || '',
|
||||
stats: comfy.ok ? comfy.stats : undefined
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user