Keep Enhance + Generate as one queue row with shared progress.

The PE stage now stays on the same jobId so the header and queue badge agree, and jobs behind it do not promote when enhance finishes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-26 14:42:22 -05:00
co-authored by Cursor
parent 30be4bd5b0
commit 99b61e67d7
9 changed files with 129 additions and 8 deletions
+16 -1
View File
@@ -125,9 +125,14 @@ async function runQwen21PromptEnhance(r: any, job: Job) {
}
}
r.peGraphId = edit ? 'studio2_qwen21_pe_edit.json' : 'studio2_qwen21_pe_t2i.json'
// PE is stage 1 of the same studio job — not a complete/requeue.
r.progress = null
saveRecord(r)
const queued = await queuePrompt(graph, job.clientId)
r.pePromptId = queued.prompt_id
// watchProgress listens on promptId; point it at the PE Comfy prompt for this stage.
r.promptId = queued.prompt_id
job.promptId = queued.prompt_id
saveRecord(r)
const history = await waitPromptHistory(r, job, queued.prompt_id)
const result = harvestQwen21Pe(history, queued.prompt_id, edit)
@@ -142,11 +147,19 @@ async function runQwen21PromptEnhance(r: any, job: Job) {
wh_ratio: result.wh_ratio || '',
...(edit ? { ratio_follow: result.ratio_follow || '' } : {}),
parse_ok: true,
thinking: result.thinking || ''
thinking: result.thinking || '',
comfyPromptId: queued.prompt_id,
}
// Stage flip PE → generate: clear PE prompt id and reset the bar (no leftover 100%).
r.pePromptId = ''
r.promptId = ''
job.promptId = ''
r.progress = null
saveRecord(r)
await freeComfyVram()
// Same job continues into generate — do not complete or requeue.
update(r, 'submitting')
emitJob(job, { type: 'status', message: 'Generating…' })
}
async function upload(r: any, name: string, data: Buffer): Promise<string> {
@@ -394,6 +407,8 @@ async function run(r: any, job: Job) {
}
job.promptId = queued.prompt_id;
r.promptId = queued.prompt_id;
r.generateComfyPromptId = queued.prompt_id;
r.progress = null;
r.renderStartedAt = Date.now();
update(r, 'rendering');
}