12 lines
997 B
JavaScript
12 lines
997 B
JavaScript
export function gpuStatus(jobs, health, upscales=[]) {
|
|
if (!health) return {label:'Status unavailable',tone:'unknown',detail:'Checking GPU connection…'}
|
|
const upscale=upscales.find(j=>j.status==='running')
|
|
if(upscale)return {label:'Upscaling',tone:'busy',detail:upscale.name || 'Video upscale'}
|
|
const job=jobs.find(j=>['waking','submitting','rendering','saving'].includes(j.state))
|
|
if(job)return {label:{waking:'Waking up',submitting:'Submitting',rendering:'Generating',saving:'Saving'}[job.state],tone:'busy',detail:job.request?.promptSections?.action || 'Generation in progress'}
|
|
if(health.comfy?.busy || health.imageComfy?.busy)return {label:'Busy',tone:'busy',detail:'GPU is working on another job'}
|
|
if(health.comfy?.ok || health.imageComfy?.ok)return {label:'Ready',tone:'ready',detail:'No job running'}
|
|
if(health.comfy?.asleep)return {label:'Sleeping',tone:'sleeping',detail:'Wakes when a job starts'}
|
|
return {label:'Offline',tone:'unknown',detail:'GPU connection unavailable'}
|
|
}
|