Show milestone progress bar for post generation queue jobs

Add percentage-by-stage progress in the queue UI, a progress rendering
test script, and clearer Chrome focus error details in the ChatGPT worker.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Loma Bot Ops
2026-11-23 15:36:52 +07:00
parent 53d39ae4cd
commit 4c691b5dde
6 changed files with 97 additions and 4 deletions
+8 -1
View File
@@ -7,7 +7,7 @@ export const POST_JOB_STATUS = {
} as const;
export const POST_JOB_STAGE: Record<string, string> = {
queued: "รอ worker รับงาน",
queued: "รอเริ่มสร้างโพสต์",
content: "Codex กำลังเขียนเนื้อหาและพรอมต์ภาพ",
image: "ChatGPT กำลังสร้างภาพ",
saving: "กำลังบันทึกฉบับร่าง",
@@ -24,3 +24,10 @@ export interface PostJobView {
startedAt: string | null;
finishedAt: string | null;
}
/** Milestones, not an estimate of the image model's internal rendering progress. */
export function postJobProgress(job: Pick<PostJobView, "status" | "stage">): number {
if (job.status === "COMPLETED") return 100;
if (job.status === "QUEUED" || job.status === "CANCELLED") return 0;
return ({ content: 10, image: 50, saving: 90 } as Record<string, number>)[job.stage] ?? 0;
}