fix(HEL-627): 补齐真实工作流参数并修正虚假完成

- 解析 ResolutionSelector 比例/总像素、KSampler/BasicScheduler 降噪,附带 ComfyUI 取值范围
- 已导入的自动识别工作流读取时按最新规则重新解析,无需重导
- 提交前后端校验参数(中文原因),非法值 400 拒绝不入队
- 任务新增 phase / comfy_prompt_id:连接中→已接收(前方排队)→执行中→保存中→完成
- 空产出、队列与历史都丢失、执行中断均判失败;Dry-run 结果标为占位,不算完成
- ComfyUI 缺模型报错写明缺哪个文件
- 生图/生视频/任务页统一用 jobStatusInfo 展示真实状态,结果区支持复用参数

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-09-28 23:05:34 +08:00
co-authored by Cursor multica-agent
parent 0031a897d7
commit 60c043db7c
24 changed files with 1499 additions and 206 deletions
+41
View File
@@ -0,0 +1,41 @@
/**
* ComfyUI ResolutionSelector (comfy_extras/nodes_resolution.py) — same
* ratios and rounding, so the size shown is the size ComfyUI renders.
*/
const RATIOS: Record<string, [number, number]> = {
'1:1 (Square)': [1, 1],
'2:3 (Portrait Photo)': [2, 3],
'3:2 (Photo)': [3, 2],
'3:4 (Portrait Standard)': [3, 4],
'4:3 (Standard)': [4, 3],
'9:16 (Portrait Widescreen)': [9, 16],
'16:9 (Widescreen)': [16, 9],
'21:9 (Ultrawide)': [21, 9],
};
/** Python's round(): halves go to the even neighbour. */
function roundHalfEven(x: number): number {
const f = Math.floor(x);
const diff = x - f;
if (diff > 0.5) return f + 1;
if (diff < 0.5) return f;
return f % 2 === 0 ? f : f + 1;
}
export function resolutionSelectorSize(
aspectRatio: string,
megapixels: number,
multiple: number,
): { width: number; height: number } | null {
const ratio = RATIOS[aspectRatio];
if (!ratio || !Number.isFinite(megapixels) || megapixels <= 0) return null;
const [w, h] = ratio;
const m = Math.max(1, Math.floor(multiple) || 8);
const scale = Math.sqrt((megapixels * 1024 * 1024) / (w * h));
return { width: roundHalfEven((w * scale) / m) * m, height: roundHalfEven((h * scale) / m) * m };
}
/** "16:9 (Widescreen)" → "16:9". */
export function ratioShort(option: string): string {
return option.split(' ')[0] ?? option;
}
+22 -1
View File
@@ -1,4 +1,12 @@
export type ComfyInputKind = 'text' | 'textarea' | 'number' | 'image' | 'image_url' | 'audio' | 'video';
export type ComfyInputKind =
| 'text'
| 'textarea'
| 'number'
| 'select'
| 'image'
| 'image_url'
| 'audio'
| 'video';
export type ComfyOutputKind = 'image' | 'video' | 'other';
export interface ComfyDynamicInput {
@@ -11,6 +19,15 @@ export interface ComfyDynamicInput {
required: boolean;
/** Inferred from node classes/wiring — the workflow carries no (Input) tags. */
auto?: boolean;
/** ComfyUI widget limits (number kind). */
min?: number;
max?: number;
step?: number;
integer?: boolean;
/** Allowed values (select kind). */
options?: string[];
/** On a ResolutionSelector aspect_ratio entry: its megapixels key and rounding multiple. */
resolution?: { megapixels: string; multiple: number };
}
export interface ComfyDynamicOutput {
@@ -57,6 +74,10 @@ export interface Job {
started_at: string | null;
completed_at: string | null;
retry_count: number;
/** Prompt id ComfyUI accepted this job under (null until /prompt succeeds). */
comfy_prompt_id?: string | null;
/** connecting · comfy_queued · comfy_running · saving · finished · dry_run */
phase?: string | null;
}
export interface SceneVideoSettings {
@@ -260,6 +260,18 @@
oninput={(e) => setNumberValue(inp.nodeId, e.currentTarget.value)}
onblur={() => markTouched(inp.nodeId)}
/>
{:else if inp.kind === 'select'}
<select
{id}
class:invalid={errored}
value={current || String(inp.defaultValue ?? '')}
onchange={(e) => setValue(inp.nodeId, e.currentTarget.value)}
onblur={() => markTouched(inp.nodeId)}
>
{#each inp.options ?? [] as opt (opt)}
<option value={opt}>{opt}</option>
{/each}
</select>
{:else if allowUpload && isUploadKind(inp.kind)}
{@const uploadingName = uploading[inp.nodeId]}
{@const isUpload = !!current && !assetOptions.some((o) => o.path === current)}
@@ -346,6 +346,16 @@
value={values[nodeId] ?? ctrl.input.defaultValue ?? ''}
oninput={(e) => setValue(nodeId, Number(e.currentTarget.value) || 0)}
/>
{:else if ctrl.input.kind === 'select'}
<select
class="adv-input"
value={String(values[nodeId] ?? ctrl.input.defaultValue ?? '')}
onchange={(e) => setValue(nodeId, e.currentTarget.value)}
>
{#each ctrl.input.options ?? [] as opt (opt)}
<option value={opt}>{opt}</option>
{/each}
</select>
{:else}
<input
class="adv-input"
@@ -26,6 +26,8 @@
import { createUploadManager } from '$lib/comfy/useUpload.svelte';
import { connectEvents } from '$lib/events';
import { handleJobEvent, progressFor } from '$lib/jobProgress';
import { jobStatusInfo } from '$lib/jobStatus';
import { ratioShort, resolutionSelectorSize } from '$lib/comfy/resolution';
import { toast } from '$lib/toast';
import { t } from '$lib/i18n.svelte';
@@ -67,13 +69,19 @@
return $jobsQuery.data ?? [];
});
const kindJobs = $derived(allJobs.filter((j) => j.kind === kind));
// Jobs are listed newest first; the worker runs the oldest pending job next.
const activeJob = $derived(
kindJobs.find((j) => j.status === 'running') ?? kindJobs.find((j) => j.status === 'pending') ?? null,
kindJobs.find((j) => j.status === 'running') ?? kindJobs.findLast((j) => j.status === 'pending') ?? null,
);
const jobsAhead = $derived(
activeJob?.status === 'pending'
? allJobs.filter((j) => j.status === 'running' || (j.status === 'pending' && j.id < activeJob.id)).length
: 0,
);
const queueCount = $derived(kindJobs.filter((j) => j.status === 'pending' || j.status === 'running').length);
const doneEntries = $derived(
kindJobs
.filter((j) => j.status === 'done' && (j.output_paths?.length ?? 0) > 0)
.filter((j) => jobStatusInfo(j).tone === 'ok')
.flatMap((j) => j.output_paths.map((p) => ({ job: j, path: p, key: `${j.id}:${p}` }))),
);
@@ -87,10 +95,20 @@
handleJobEvent(ev);
if (ev.type === 'job.failed' && !ev.data.cancelled) {
const id = Number(ev.data.job_id);
if (submittedIds.has(id) || kindJobs.some((j) => j.id === id)) {
// The SSE backlog replays old failures on every connect.
const known = kindJobs.find((j) => j.id === id);
if (submittedIds.has(id) || (known && known.status !== 'failed')) {
toast.error(t('studio.jobFailedToast', { detail: String(ev.data.error ?? '') }));
}
}
if (ev.type === 'job.completed' && submittedIds.has(Number(ev.data.job_id))) {
if (ev.data.dry_run) {
toast.info(t('studio.dryRunToast'));
} else {
const outputs = Array.isArray(ev.data.outputs) ? ev.data.outputs.length : 0;
toast.success(t('studio.doneToast', { n: outputs, id: String(ev.data.comfy_prompt_id ?? '—') }));
}
}
if (ev.type.startsWith('job.') || ev.type === 'events.resync') {
void client.invalidateQueries({ queryKey: ['playground-jobs'] });
void client.invalidateQueries({ queryKey: ['jobs'] });
@@ -180,8 +198,21 @@
const cfgInp = $derived(
schema.find((i) => /\bcfg\b|引导/.test(hay(i)) && !isMedia(i)) ?? null,
);
const denoiseInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'denoise') ?? null);
const batchInp = $derived(schema.find((i) => /批次|batch/.test(hay(i)) && !isMedia(i)) ?? null);
const fpsInp = $derived(schema.find((i) => /帧率|fps|frame.?rate/.test(hay(i)) && !isMedia(i)) ?? null);
// ComfyUI ResolutionSelector: the ratio + megapixels pair decides width/height.
const ratioInp = $derived(
schema.find((i) => i.kind === 'select' && role(i) === 'aspect_ratio' && i.resolution) ?? null,
);
const megapixelsInp = $derived(
ratioInp ? (schema.find((i) => i.nodeId === ratioInp.resolution!.megapixels) ?? null) : null,
);
const outputSize = $derived.by(() => {
if (!ratioInp?.resolution) return null;
const mp = Number(values[megapixelsInp?.nodeId ?? ''] ?? megapixelsInp?.defaultValue);
return resolutionSelectorSize(String(values[ratioInp.nodeId] ?? ratioInp.defaultValue ?? ''), mp, ratioInp.resolution.multiple);
});
interface SlotDef {
inp: ComfyDynamicInput;
@@ -232,8 +263,11 @@
durationInp,
stepsInp,
cfgInp,
denoiseInp,
batchInp,
fpsInp,
ratioInp,
megapixelsInp,
]
.filter(Boolean)
.map((i) => i!.nodeId),
@@ -307,9 +341,32 @@
errs[inp.nodeId] = t('studio.errFill', { label: inp.label });
}
}
for (const inp of schema) {
const raw = values[inp.nodeId];
if (raw === undefined || String(raw).trim() === '' || errs[inp.nodeId]) continue;
const msg = valueError(inp, raw);
if (msg) errs[inp.nodeId] = msg;
}
return errs;
});
/** Same rules the backend enforces before queueing (comfyui/validate.py). */
function valueError(inp: ComfyDynamicInput, raw: string | number): string | null {
const label = inp.label;
if (inp.kind === 'select') {
return inp.options?.length && !inp.options.includes(String(raw))
? t('studio.errOption', { label })
: null;
}
if (inp.kind !== 'number') return null;
const n = Number(raw);
if (!Number.isFinite(n)) return t('studio.errNumber', { label });
if (inp.integer && !Number.isInteger(n)) return t('studio.errInteger', { label });
if (inp.min != null && n < inp.min) return t('studio.errMin', { label, v: inp.min });
if (inp.max != null && n > inp.max) return t('studio.errMax', { label, v: inp.max });
return null;
}
function setVal(nodeId: string, v: string | number) {
values = { ...values, [nodeId]: v };
}
@@ -319,7 +376,7 @@
return;
}
const n = Number(raw);
if (!Number.isNaN(n)) setVal(nodeId, n);
setVal(nodeId, Number.isNaN(n) ? raw : n);
}
// ------------------------------------------------------------------
@@ -332,7 +389,7 @@
const imageResults = $derived(
allJobs
.filter((j) => j.kind === 'image' && j.status === 'done' && (j.output_paths?.length ?? 0) > 0)
.filter((j) => j.kind === 'image' && jobStatusInfo(j).tone === 'ok')
.flatMap((j) => j.output_paths.map((p) => ({ job: j, path: p }))),
);
@@ -415,9 +472,13 @@
return () => clearInterval(id);
});
const activeStatus = $derived(activeJob ? jobStatusInfo(activeJob) : null);
// ComfyUI reports no percent: the bar only moves while ComfyUI is really
// executing and never fills (job.completed ends the card instead).
const progress = $derived.by(() => {
if (!activeJob) return 0;
if (activeJob.status === 'pending') return 0;
if (!activeJob || activeJob.status !== 'running') return 0;
const phase = progressFor(activeJob.id)?.phase ?? activeJob.phase;
if (phase !== 'comfy_running' && phase !== 'saving') return 0;
return progressFor(activeJob.id)?.progress ?? 3;
});
@@ -457,22 +518,6 @@
return null;
}
const frameTotal = $derived.by(() => {
if (kind !== 'video' || !activeJob) return null;
const dur = Number(jobValueByRole(activeJob, 'duration'));
const fps = Number(
(() => {
const wf = ($workflowsQuery.data ?? []).find((w) => w.id === activeJob.workflow_id);
const inp = (wf?.input_schema ?? []).find((i) => /帧率|fps|frame.?rate/i.test(`${i.role ?? ''} ${i.label}`));
if (!inp) return null;
const vals = (activeJob.payload?.input_values ?? {}) as Record<string, unknown>;
return vals[inp.nodeId] ?? inp.defaultValue ?? null;
})(),
);
if (Number.isFinite(dur) && dur > 0 && Number.isFinite(fps) && fps > 0) return Math.round(dur * fps);
return null;
});
const endpointName = $derived(
((activeJob?.payload?.endpoint as Record<string, unknown> | undefined)?.name as string) ??
endpoints.find((e) => e.id === endpointId)?.name ??
@@ -502,14 +547,25 @@
function summaryOf(job: Job): string {
const parts: string[] = [];
const wf = ($workflowsQuery.data ?? []).find((x) => x.id === job.workflow_id);
const w = jobValueByRole(job, 'width');
const h = jobValueByRole(job, 'height');
const ratio = (wf?.input_schema ?? []).find((i) => normalizeInputRole(i.role ?? null) === 'aspect_ratio' && i.resolution);
if (w && h) parts.push(`${w}×${h}`);
else if (ratio?.resolution) {
const vals = (job.payload?.input_values ?? {}) as Record<string, unknown>;
const mpDefault = wf?.input_schema.find((i) => i.nodeId === ratio.resolution!.megapixels)?.defaultValue;
const size = resolutionSelectorSize(
String(vals[ratio.nodeId] ?? ratio.defaultValue ?? ''),
Number(vals[ratio.resolution.megapixels] ?? mpDefault),
ratio.resolution.multiple,
);
if (size) parts.push(`${size.width}×${size.height}`);
}
const seed = jobValueByRole(job, 'seed');
if (seed) parts.push(t('studio.seedLabel') + ' ' + seed);
const dur = jobValueByRole(job, 'duration');
if (dur) parts.push(`${dur}s`);
const wf = ($workflowsQuery.data ?? []).find((x) => x.id === job.workflow_id);
if (wf) parts.push(wf.name);
return parts.join(' · ');
}
@@ -587,6 +643,28 @@
// ------------------------------------------------------------------
// History actions
// ------------------------------------------------------------------
/** Fill the form back with a past job's values (on its own workflow). */
function reuseParams(job: Job) {
const wf = kindWorkflows.find((w) => w.id === job.workflow_id);
if (!wf) {
toast.error(t('studio.reuseMissingWf'));
return;
}
const next: Record<string, string | number> = {};
for (const inp of wf.input_schema ?? []) {
if (inp.defaultValue !== undefined && inp.defaultValue !== '') next[inp.nodeId] = inp.defaultValue;
}
const past = (job.payload?.input_values ?? {}) as Record<string, unknown>;
for (const [k, v] of Object.entries(past)) {
if (typeof v === 'string' || typeof v === 'number') next[k] = v;
}
workflowId = wf.id;
lastWfId = wf.id;
values = next;
showErrors = false;
toast.success(t('studio.reusedToast'));
}
async function retryJob(job: Job) {
if (retryingId != null) return;
retryingId = job.id;
@@ -642,6 +720,10 @@
}
</script>
{#snippet fieldError(inp: ComfyDynamicInput)}
{#if showErrors && errors[inp.nodeId]?.trim()}<span class="f-error">{errors[inp.nodeId]}</span>{/if}
{/snippet}
<AppShell
active={kind}
title={kind === 'image' ? t('studio.image.title') : t('studio.video.title')}
@@ -691,6 +773,9 @@
</span>
{/if}
</div>
{#if dryRun}
<p class="missing-note">{t('studio.dryRunNote')}</p>
{/if}
<div class="f-field">
<span class="f-label">
{t('studio.connLabel')}
@@ -849,122 +934,190 @@
<span class="f-label">{t('studio.seedLabel')}</span>
<input
class="f-input mono"
class:invalid={showErrors && errors[seedInp.nodeId]}
type="text"
inputmode="numeric"
value={String(values[seedInp.nodeId] ?? '')}
oninput={(e) => numVal(seedInp.nodeId, e.currentTarget.value)}
/>
{@render fieldError(seedInp)}
</label>
{/if}
</div>
{#if kind === 'image'}
{#if widthInp || heightInp || batchInp}
<div class="pair-row">
{#if widthInp && heightInp}
<div class="f-field">
<span class="f-label">{t('studio.sizeLabel')}</span>
<div class="size-row">
<input
class="f-input mono"
type="number"
placeholder="W"
value={String(values[widthInp.nodeId] ?? '')}
oninput={(e) => numVal(widthInp.nodeId, e.currentTarget.value)}
/>
<span class="size-x">×</span>
<input
class="f-input mono"
type="number"
placeholder="H"
value={String(values[heightInp.nodeId] ?? '')}
oninput={(e) => numVal(heightInp.nodeId, e.currentTarget.value)}
/>
</div>
</div>
{/if}
{#if batchInp}
<label class="f-field">
<span class="f-label">{t('studio.batchLabel')}</span>
<input
class="f-input mono"
type="number"
min="1"
value={String(values[batchInp.nodeId] ?? '')}
oninput={(e) => numVal(batchInp.nodeId, e.currentTarget.value)}
/>
</label>
{/if}
</div>
{/if}
{#if stepsInp || cfgInp}
<div class="pair-row">
{#if stepsInp}
<label class="f-field">
<span class="f-label">
{t('studio.stepsLabel')}
<span class="f-hint-inline mono">{values[stepsInp.nodeId] ?? '—'}</span>
{#if ratioInp}
<div class="pair-row">
<label class="f-field">
<span class="f-label">{t('studio.ratioLabel')}</span>
<select
class="f-input"
class:invalid={showErrors && errors[ratioInp.nodeId]}
value={String(values[ratioInp.nodeId] ?? ratioInp.defaultValue ?? '')}
onchange={(e) => setVal(ratioInp.nodeId, e.currentTarget.value)}
>
{#each ratioInp.options ?? [] as opt (opt)}
<option value={opt}>{ratioShort(opt)}</option>
{/each}
</select>
{@render fieldError(ratioInp)}
</label>
{#if megapixelsInp}
<label class="f-field">
<span class="f-label">{t('studio.megapixelsLabel')}</span>
<input
class="f-input mono"
class:invalid={showErrors && errors[megapixelsInp.nodeId]}
type="number"
min={megapixelsInp.min}
max={megapixelsInp.max}
step={megapixelsInp.step ?? 0.1}
value={String(values[megapixelsInp.nodeId] ?? '')}
oninput={(e) => numVal(megapixelsInp.nodeId, e.currentTarget.value)}
/>
{#if outputSize}
<span class="panel-hint mono">
{t('studio.outputSize', { w: outputSize.width, h: outputSize.height })}
</span>
<input
class="a-range"
type="range"
min="1"
max="150"
step="1"
value={Number(values[stepsInp.nodeId] ?? 20)}
oninput={(e) => setVal(stepsInp.nodeId, Number(e.currentTarget.value))}
/>
</label>
{/if}
{#if cfgInp}
<label class="f-field">
<span class="f-label">
{t('studio.cfgLabel')}
<span class="f-hint-inline mono">{values[cfgInp.nodeId] ?? '—'}</span>
</span>
<input
class="a-range"
type="range"
min="1"
max="20"
step="0.5"
value={Number(values[cfgInp.nodeId] ?? 7)}
oninput={(e) => setVal(cfgInp.nodeId, Number(e.currentTarget.value))}
/>
</label>
{/if}
{/if}
{@render fieldError(megapixelsInp)}
</label>
{/if}
</div>
{:else if widthInp && heightInp}
<div class="f-field">
<span class="f-label">{t('studio.sizeLabel')}</span>
<div class="size-row">
<input
class="f-input mono"
class:invalid={showErrors && errors[widthInp.nodeId]}
type="number"
placeholder="W"
min={widthInp.min}
max={widthInp.max}
step={widthInp.step}
value={String(values[widthInp.nodeId] ?? '')}
oninput={(e) => numVal(widthInp.nodeId, e.currentTarget.value)}
/>
<span class="size-x">×</span>
<input
class="f-input mono"
class:invalid={showErrors && errors[heightInp.nodeId]}
type="number"
placeholder="H"
min={heightInp.min}
max={heightInp.max}
step={heightInp.step}
value={String(values[heightInp.nodeId] ?? '')}
oninput={(e) => numVal(heightInp.nodeId, e.currentTarget.value)}
/>
</div>
{/if}
{:else}
{#if durationInp || fpsInp}
<div class="pair-row">
{#if durationInp}
<label class="f-field">
<span class="f-label">{t('studio.durationLabel')}</span>
<input
class="f-input mono"
type="number"
min="0"
step="0.5"
value={String(values[durationInp.nodeId] ?? '')}
oninput={(e) => numVal(durationInp.nodeId, e.currentTarget.value)}
/>
</label>
{/if}
{#if fpsInp}
<label class="f-field">
<span class="f-label">{t('studio.fpsLabel')}</span>
<input
class="f-input mono"
type="number"
min="1"
value={String(values[fpsInp.nodeId] ?? '')}
oninput={(e) => numVal(fpsInp.nodeId, e.currentTarget.value)}
/>
</label>
{/if}
</div>
{/if}
{@render fieldError(widthInp)}
{@render fieldError(heightInp)}
</div>
{/if}
{#if stepsInp || cfgInp || denoiseInp || batchInp || durationInp || fpsInp}
<div class="pair-row">
{#if durationInp}
<label class="f-field">
<span class="f-label">{t('studio.durationLabel')}</span>
<input
class="f-input mono"
class:invalid={showErrors && errors[durationInp.nodeId]}
type="number"
min={durationInp.min ?? 0}
step="0.5"
value={String(values[durationInp.nodeId] ?? '')}
oninput={(e) => numVal(durationInp.nodeId, e.currentTarget.value)}
/>
{@render fieldError(durationInp)}
</label>
{/if}
{#if fpsInp}
<label class="f-field">
<span class="f-label">{t('studio.fpsLabel')}</span>
<input
class="f-input mono"
class:invalid={showErrors && errors[fpsInp.nodeId]}
type="number"
min="1"
value={String(values[fpsInp.nodeId] ?? '')}
oninput={(e) => numVal(fpsInp.nodeId, e.currentTarget.value)}
/>
{@render fieldError(fpsInp)}
</label>
{/if}
{#if batchInp}
<label class="f-field">
<span class="f-label">{t('studio.batchLabel')}</span>
<input
class="f-input mono"
class:invalid={showErrors && errors[batchInp.nodeId]}
type="number"
min={batchInp.min ?? 1}
max={batchInp.max}
step="1"
value={String(values[batchInp.nodeId] ?? '')}
oninput={(e) => numVal(batchInp.nodeId, e.currentTarget.value)}
/>
{@render fieldError(batchInp)}
</label>
{/if}
{#if stepsInp}
<label class="f-field">
<span class="f-label">
{t('studio.stepsLabel')}
<span class="f-hint-inline mono">{values[stepsInp.nodeId] ?? '—'}</span>
</span>
<input
class="a-range"
type="range"
min={stepsInp.min ?? 1}
max={Math.max(150, Number(values[stepsInp.nodeId] ?? stepsInp.defaultValue ?? 0))}
step="1"
value={Number(values[stepsInp.nodeId] ?? stepsInp.defaultValue ?? 20)}
oninput={(e) => setVal(stepsInp.nodeId, Number(e.currentTarget.value))}
/>
{@render fieldError(stepsInp)}
</label>
{/if}
{#if cfgInp}
<label class="f-field">
<span class="f-label">
{t('studio.cfgLabel')}
<span class="f-hint-inline mono">{values[cfgInp.nodeId] ?? '—'}</span>
</span>
<input
class="a-range"
type="range"
min={cfgInp.min ?? 0}
max={Math.max(20, Number(values[cfgInp.nodeId] ?? cfgInp.defaultValue ?? 0))}
step="0.1"
value={Number(values[cfgInp.nodeId] ?? cfgInp.defaultValue ?? 7)}
oninput={(e) => setVal(cfgInp.nodeId, Number(e.currentTarget.value))}
/>
{@render fieldError(cfgInp)}
</label>
{/if}
{#if denoiseInp}
<label class="f-field">
<span class="f-label">
{t('studio.denoiseLabel')}
<span class="f-hint-inline mono">{values[denoiseInp.nodeId] ?? '—'}</span>
</span>
<input
class="a-range"
type="range"
min={denoiseInp.min ?? 0}
max={denoiseInp.max ?? 1}
step={denoiseInp.step ?? 0.01}
value={Number(values[denoiseInp.nodeId] ?? denoiseInp.defaultValue ?? 1)}
oninput={(e) => setVal(denoiseInp.nodeId, Number(e.currentTarget.value))}
/>
{@render fieldError(denoiseInp)}
</label>
{/if}
</div>
{/if}
{#if restInputs.length}
@@ -988,9 +1141,23 @@
class="f-input mono"
class:invalid={showErrors && errors[inp.nodeId]}
type="number"
min={inp.min}
max={inp.max}
step={inp.step ?? 'any'}
value={String(values[inp.nodeId] ?? '')}
oninput={(e) => numVal(inp.nodeId, e.currentTarget.value)}
/>
{:else if inp.kind === 'select'}
<select
class="f-input"
class:invalid={showErrors && errors[inp.nodeId]}
value={String(values[inp.nodeId] ?? inp.defaultValue ?? '')}
onchange={(e) => setVal(inp.nodeId, e.currentTarget.value)}
>
{#each inp.options ?? [] as opt (opt)}
<option value={opt}>{opt}</option>
{/each}
</select>
{:else}
<input
class="f-input"
@@ -1056,25 +1223,18 @@
{#if activeJob}
<div class="task-body">
{#if activeJob.status === 'pending'}
<div class="pct mono">—</div>
<div class="pct">{activeStatus?.label}</div>
<div class="task-meta mono">
{t('studio.taskQueued')} ·
{t('studio.queuedBehind', { n: kindJobs.filter((j) => j.status === 'pending').indexOf(activeJob) })}
{activeStatus?.detail} ·
{t('studio.queuedBehind', { n: jobsAhead })}
</div>
{:else}
<div class="pct mono">{Math.round(progress)}<span class="pct-sign">%</span></div>
<div class="progress" role="progressbar" aria-valuenow={Math.round(progress)} aria-valuemin="0" aria-valuemax="100">
<div class="pct">{activeStatus?.label}</div>
<div class="progress" role="progressbar" aria-valuetext={activeStatus?.detail}>
<div class="fill" style={`width:${progress}%`}></div>
</div>
<div class="task-meta mono">
{#if kind === 'video' && frameTotal}
{t('studio.renderFrames', {
done: Math.round((progress / 100) * frameTotal),
total: frameTotal,
})} ·
{:else if stepsInp && values[stepsInp.nodeId]}
{t('studio.stepsShort', { v: values[stepsInp.nodeId] })} ·
{/if}
{activeStatus?.detail} ·
{t('studio.usedShort', { v: elapsedOf(activeJob) })}
{#if etaSec != null} · {t('studio.etaShort', { v: fmtDur(etaSec) })}{/if}
· {t('studio.targetShort', { name: endpointName })}
@@ -1114,6 +1274,10 @@
<Icon name="image" size={13} />
{t('studio.zoom')}
</Button>
<Button variant="secondary" size="sm" onclick={() => reuseParams(selectedEntry!.job)}>
<Icon name="retry" size={13} />
{t('studio.reuseParams')}
</Button>
<Button variant="secondary" size="sm" onclick={() => sendToImg2Img(selectedEntry!.path)}>
<Icon name="upload" size={13} />
{t('studio.sendToImg2Img')}
@@ -1195,6 +1359,10 @@
<Icon name="check" size={13} />
{t('studio.copyPrompt')}
</Button>
<Button variant="secondary" size="sm" onclick={() => reuseParams(selectedEntry!.job)}>
<Icon name="retry" size={13} />
{t('studio.reuseParams')}
</Button>
<Button
variant="secondary"
size="sm"
@@ -1231,6 +1399,7 @@
{:else}
<div class="history-list">
{#each kindJobs as job (job.id)}
{@const st = jobStatusInfo(job)}
<div class="hist-row" class:failed={job.status === 'failed'} class:video={kind === 'video'}>
<div class="hist-thumb" class:video={kind === 'video'}>
{#if job.output_paths?.[0]}
@@ -1257,12 +1426,8 @@
<div class="hist-name" title={wfName(job)}>{wfName(job)}</div>
<div class="hist-meta mono">{summaryOf(job)}</div>
<div class="hist-status">
{#if job.status === 'done'}
<span class="st ok">{t('home.jobDone')}</span>
{:else if job.status === 'running'}
<span class="st run mono">{Math.round(progressFor(job.id)?.progress ?? 3)}%</span>
{:else if job.status === 'pending'}
<span class="st queue">{t('studio.taskQueued')}</span>
{#if job.status !== 'failed'}
<span class="st {st.tone}" title={st.detail}>{st.label}</span>
{:else}
<button
type="button"
@@ -1287,6 +1452,8 @@
</div>
{#if job.status === 'failed' && job.error}
<div class="hist-error">{job.error}</div>
{:else if st.tone === 'fail' || (job.status === 'done' && job.phase === 'dry_run')}
<div class="hist-error">{st.detail}</div>
{/if}
</div>
</div>
@@ -1594,11 +1761,6 @@
color: var(--text);
line-height: 1.1;
}
.pct-sign {
font-size: 16px;
color: var(--text-2);
margin-left: 2px;
}
.progress {
height: 4px;
border-radius: 999px;
@@ -2004,6 +2166,9 @@
color: var(--text-3);
font-weight: 400;
}
.st.fail {
color: var(--error);
}
.fail-link {
background: none;
border: none;
+35
View File
@@ -1761,4 +1761,39 @@ export const de: Dict = {
'home.errScriptShort': 'Drehbuch zu kurz — prüfe den eingefügten Text (mind. 30 Zeichen)',
'home.stageProgress': 'Fünf-Phasen-Fortschritt',
'tasks.sourceWorkbench': 'Kreativ-Fluss',
'jobst.idSuffix': ' · ComfyUI-Prompt-ID {id}',
'jobst.done': 'Fertig',
'jobst.doneDetail': 'ComfyUI ist fertig, Ergebnisse gespeichert',
'jobst.dryRun': 'Platzhalter',
'jobst.dryRunDetail': 'Nur Platzhalter: Dry-run ist aktiv, ComfyUI wurde nicht aufgerufen',
'jobst.noOutput': 'Keine Ausgabe',
'jobst.noOutputDetail': 'Der Job endete ohne Ergebnisdatei – keine fertige Generierung',
'jobst.queued': 'Wartet',
'jobst.queuedDetail': 'Wartet in der Workbench-Warteschlange auf ComfyUI',
'jobst.connecting': 'Verbinde',
'jobst.connectingDetail': 'Verbinde mit ComfyUI und lade Eingaben hoch',
'jobst.comfyQueued': 'Angenommen',
'jobst.comfyQueuedDetail': 'ComfyUI hat den Job angenommen und eingereiht',
'jobst.comfyQueuedAhead': 'ComfyUI hat den Job angenommen – {n} davor in der Warteschlange',
'jobst.comfyRunning': 'Läuft',
'jobst.comfyRunningDetail': 'ComfyUI führt den Job aus',
'jobst.saving': 'Speichert',
'jobst.savingDetail': 'ComfyUI hat Ergebnisse geliefert, lade herunter',
'jobst.failed': 'Fehlgeschlagen',
'jobst.cancelled': 'Abgebrochen',
'studio.ratioLabel': 'Seitenverhältnis',
'studio.megapixelsLabel': 'Megapixel',
'studio.outputSize': 'Ausgabe {w} × {h}',
'studio.denoiseLabel': 'Entrauschen',
'studio.errNumber': '„{label}“ muss eine Zahl sein',
'studio.errInteger': '„{label}“ muss eine ganze Zahl sein',
'studio.errMin': '„{label}“ muss mindestens {v} sein',
'studio.errMax': '„{label}“ darf höchstens {v} sein',
'studio.errOption': '„{label}“ ist keine Option des Workflows',
'studio.reuseParams': 'Einstellungen übernehmen',
'studio.reusedToast': 'Einstellungen dieses Jobs übernommen – anpassen und neu generieren',
'studio.reuseMissingWf': 'Der Workflow dieses Jobs existiert nicht mehr',
'studio.doneToast': 'Fertig: {n} Datei(en) (ComfyUI-Prompt-ID {id})',
'studio.dryRunToast': 'Nur Platzhalter: Dry-run ist aktiv, ComfyUI wurde nicht aufgerufen',
'studio.dryRunNote': 'Dry-run ist aktiv: Generieren schreibt nur Platzhalter und ruft ComfyUI nie auf. In den Einstellungen abschalten.',
};
+35
View File
@@ -1760,6 +1760,41 @@ export const en = {
'home.errScriptShort': 'The script looks too short — check the paste is complete (min 30 characters)',
'home.stageProgress': 'Five-stage progress',
'tasks.sourceWorkbench': 'Creation flow',
'jobst.idSuffix': ' · ComfyUI prompt ID {id}',
'jobst.done': 'Done',
'jobst.doneDetail': 'ComfyUI finished and the results are saved',
'jobst.dryRun': 'Placeholder',
'jobst.dryRunDetail': 'Placeholder only: Dry-run is on, ComfyUI was not called',
'jobst.noOutput': 'No output',
'jobst.noOutputDetail': 'The job ended without any result file — not a finished generation',
'jobst.queued': 'Queued',
'jobst.queuedDetail': 'Waiting in the workbench queue to be sent to ComfyUI',
'jobst.connecting': 'Connecting',
'jobst.connectingDetail': 'Connecting to ComfyUI and uploading inputs',
'jobst.comfyQueued': 'Accepted',
'jobst.comfyQueuedDetail': 'ComfyUI accepted the job and queued it',
'jobst.comfyQueuedAhead': 'ComfyUI accepted the job — {n} ahead in its queue',
'jobst.comfyRunning': 'Running',
'jobst.comfyRunningDetail': 'ComfyUI is running the job',
'jobst.saving': 'Saving',
'jobst.savingDetail': 'ComfyUI returned results, downloading them',
'jobst.failed': 'Failed',
'jobst.cancelled': 'Cancelled',
'studio.ratioLabel': 'Aspect ratio',
'studio.megapixelsLabel': 'Megapixels',
'studio.outputSize': 'Output {w} × {h}',
'studio.denoiseLabel': 'Denoise',
'studio.errNumber': '“{label}” must be a number',
'studio.errInteger': '“{label}” must be a whole number',
'studio.errMin': '“{label}” must be at least {v}',
'studio.errMax': '“{label}” must be at most {v}',
'studio.errOption': '“{label}” is not one of the workflow\'s options',
'studio.reuseParams': 'Reuse settings',
'studio.reusedToast': 'Settings from this job are filled in — adjust and generate again',
'studio.reuseMissingWf': 'The workflow this job used no longer exists',
'studio.doneToast': 'Done: {n} file(s) (ComfyUI prompt ID {id})',
'studio.dryRunToast': 'Placeholder only: Dry-run is on, ComfyUI was not called',
'studio.dryRunNote': 'Dry-run is on: Generate only writes placeholder files and never calls ComfyUI. Turn it off in Settings.',
};
export type Dict = typeof en;
+35
View File
@@ -1761,4 +1761,39 @@ export const es: Dict = {
'home.errScriptShort': 'El guion es demasiado corto — revisa el pegado (mín. 30 caracteres)',
'home.stageProgress': 'Progreso de cinco etapas',
'tasks.sourceWorkbench': 'Flujo de creación',
'jobst.idSuffix': ' · ID de prompt de ComfyUI {id}',
'jobst.done': 'Listo',
'jobst.doneDetail': 'ComfyUI terminó y los resultados se guardaron',
'jobst.dryRun': 'Marcador',
'jobst.dryRunDetail': 'Solo marcador: Dry-run activo, no se llamó a ComfyUI',
'jobst.noOutput': 'Sin salida',
'jobst.noOutputDetail': 'El trabajo terminó sin archivos de resultado: no cuenta como generado',
'jobst.queued': 'En cola',
'jobst.queuedDetail': 'Esperando en la cola del taller para enviarse a ComfyUI',
'jobst.connecting': 'Conectando',
'jobst.connectingDetail': 'Conectando con ComfyUI y subiendo entradas',
'jobst.comfyQueued': 'Aceptado',
'jobst.comfyQueuedDetail': 'ComfyUI aceptó el trabajo y lo puso en cola',
'jobst.comfyQueuedAhead': 'ComfyUI aceptó el trabajo: {n} por delante en su cola',
'jobst.comfyRunning': 'Ejecutando',
'jobst.comfyRunningDetail': 'ComfyUI está ejecutando el trabajo',
'jobst.saving': 'Guardando',
'jobst.savingDetail': 'ComfyUI devolvió resultados, descargándolos',
'jobst.failed': 'Fallido',
'jobst.cancelled': 'Cancelado',
'studio.ratioLabel': 'Relación de aspecto',
'studio.megapixelsLabel': 'Megapíxeles',
'studio.outputSize': 'Salida {w} × {h}',
'studio.denoiseLabel': 'Eliminación de ruido',
'studio.errNumber': '«{label}» debe ser un número',
'studio.errInteger': '«{label}» debe ser un número entero',
'studio.errMin': '«{label}» debe ser al menos {v}',
'studio.errMax': '«{label}» debe ser como máximo {v}',
'studio.errOption': '«{label}» no es una opción del flujo',
'studio.reuseParams': 'Reutilizar ajustes',
'studio.reusedToast': 'Ajustes de este trabajo aplicados: modifícalos y genera de nuevo',
'studio.reuseMissingWf': 'El flujo que usó este trabajo ya no existe',
'studio.doneToast': 'Listo: {n} archivo(s) (ID de prompt de ComfyUI {id})',
'studio.dryRunToast': 'Solo marcador: Dry-run activo, no se llamó a ComfyUI',
'studio.dryRunNote': 'Dry-run activo: Generar solo escribe marcadores y nunca llama a ComfyUI. Desactívalo en Ajustes.',
};
+35
View File
@@ -1761,4 +1761,39 @@ export const fr: Dict = {
'home.errScriptShort': 'Scénario trop court — vérifiez le collage (30 caractères min.)',
'home.stageProgress': 'Progression en cinq étapes',
'tasks.sourceWorkbench': 'Flux de création',
'jobst.idSuffix': ' · ID de prompt ComfyUI {id}',
'jobst.done': 'Terminé',
'jobst.doneDetail': 'ComfyUI a terminé, résultats enregistrés',
'jobst.dryRun': 'Substitut',
'jobst.dryRunDetail': 'Substitut uniquement : Dry-run actif, ComfyUI n\'a pas été appelé',
'jobst.noOutput': 'Aucune sortie',
'jobst.noOutputDetail': 'La tâche s\'est terminée sans fichier de résultat : pas une génération',
'jobst.queued': 'En attente',
'jobst.queuedDetail': 'En attente dans la file de l\'atelier avant envoi à ComfyUI',
'jobst.connecting': 'Connexion',
'jobst.connectingDetail': 'Connexion à ComfyUI et envoi des entrées',
'jobst.comfyQueued': 'Acceptée',
'jobst.comfyQueuedDetail': 'ComfyUI a accepté la tâche et l\'a mise en file',
'jobst.comfyQueuedAhead': 'ComfyUI a accepté la tâche — {n} devant dans sa file',
'jobst.comfyRunning': 'En cours',
'jobst.comfyRunningDetail': 'ComfyUI exécute la tâche',
'jobst.saving': 'Enregistrement',
'jobst.savingDetail': 'ComfyUI a renvoyé des résultats, téléchargement',
'jobst.failed': 'Échec',
'jobst.cancelled': 'Annulée',
'studio.ratioLabel': 'Format d\'image',
'studio.megapixelsLabel': 'Mégapixels',
'studio.outputSize': 'Sortie {w} × {h}',
'studio.denoiseLabel': 'Débruitage',
'studio.errNumber': '« {label} » doit être un nombre',
'studio.errInteger': '« {label} » doit être un entier',
'studio.errMin': '« {label} » doit valoir au moins {v}',
'studio.errMax': '« {label} » doit valoir au plus {v}',
'studio.errOption': '« {label} » n\'est pas une option du workflow',
'studio.reuseParams': 'Réutiliser les réglages',
'studio.reusedToast': 'Réglages de cette tâche repris : ajustez puis relancez',
'studio.reuseMissingWf': 'Le workflow de cette tâche n\'existe plus',
'studio.doneToast': 'Terminé : {n} fichier(s) (ID de prompt ComfyUI {id})',
'studio.dryRunToast': 'Substitut uniquement : Dry-run actif, ComfyUI n\'a pas été appelé',
'studio.dryRunNote': 'Dry-run actif : Générer n\'écrit que des substituts et n\'appelle jamais ComfyUI. Désactivez-le dans Réglages.',
};
+35
View File
@@ -1761,4 +1761,39 @@ export const ja: Dict = {
'home.errScriptShort': '脚本が短すぎます。貼り付けが完全か確認してください(30 文字以上)',
'home.stageProgress': '五段階の進捗',
'tasks.sourceWorkbench': '制作フロー',
'jobst.idSuffix': ' · ComfyUI プロンプト ID {id}',
'jobst.done': '完了',
'jobst.doneDetail': 'ComfyUI の実行が完了し、結果を保存しました',
'jobst.dryRun': 'プレースホルダー',
'jobst.dryRunDetail': 'プレースホルダーのみ:Dry-run が有効で ComfyUI は呼び出されていません',
'jobst.noOutput': '出力なし',
'jobst.noOutputDetail': '結果ファイルなしで終了しました(生成完了ではありません)',
'jobst.queued': '待機中',
'jobst.queuedDetail': 'ワークベンチのキューで ComfyUI への送信を待っています',
'jobst.connecting': '接続中',
'jobst.connectingDetail': 'ComfyUI に接続して素材をアップロードしています',
'jobst.comfyQueued': '受付済み',
'jobst.comfyQueuedDetail': 'ComfyUI が受け付け、実行待ちです',
'jobst.comfyQueuedAhead': 'ComfyUI が受け付けました。前に {n} 件あります',
'jobst.comfyRunning': '実行中',
'jobst.comfyRunningDetail': 'ComfyUI が実行中です',
'jobst.saving': '保存中',
'jobst.savingDetail': 'ComfyUI の結果をダウンロードしています',
'jobst.failed': '失敗',
'jobst.cancelled': 'キャンセル済み',
'studio.ratioLabel': 'アスペクト比',
'studio.megapixelsLabel': '総画素数(MP)',
'studio.outputSize': '出力 {w} × {h}',
'studio.denoiseLabel': 'ノイズ除去',
'studio.errNumber': '「{label}」は数値で入力してください',
'studio.errInteger': '「{label}」は整数で入力してください',
'studio.errMin': '「{label}」は {v} 以上にしてください',
'studio.errMax': '「{label}」は {v} 以下にしてください',
'studio.errOption': '「{label}」はワークフローの選択肢にありません',
'studio.reuseParams': '設定を再利用',
'studio.reusedToast': 'このジョブの設定を反映しました。調整して再生成できます',
'studio.reuseMissingWf': 'このジョブのワークフローはもう存在しません',
'studio.doneToast': '完了:{n} ファイル(ComfyUI プロンプト ID {id})',
'studio.dryRunToast': 'プレースホルダーのみ:Dry-run が有効で ComfyUI は呼び出されていません',
'studio.dryRunNote': 'Dry-run が有効です:生成はプレースホルダーを書き出すだけで ComfyUI を呼び出しません。設定でオフにできます。',
};
+35
View File
@@ -1761,4 +1761,39 @@ export const ko: Dict = {
'home.errScriptShort': '대본이 너무 짧습니다. 붙여넣기가 완전한지 확인하세요(30자 이상)',
'home.stageProgress': '5단계 진행',
'tasks.sourceWorkbench': '제작 흐름',
'jobst.idSuffix': ' · ComfyUI 프롬프트 ID {id}',
'jobst.done': '완료',
'jobst.doneDetail': 'ComfyUI 실행이 끝나 결과를 저장했습니다',
'jobst.dryRun': '자리표시자',
'jobst.dryRunDetail': '자리표시자만: Dry-run이 켜져 있어 ComfyUI를 호출하지 않았습니다',
'jobst.noOutput': '출력 없음',
'jobst.noOutputDetail': '결과 파일 없이 끝났습니다 — 생성 완료가 아닙니다',
'jobst.queued': '대기 중',
'jobst.queuedDetail': '워크벤치 대기열에서 ComfyUI 전송을 기다리는 중',
'jobst.connecting': '연결 중',
'jobst.connectingDetail': 'ComfyUI에 연결하고 입력을 업로드하는 중',
'jobst.comfyQueued': '접수됨',
'jobst.comfyQueuedDetail': 'ComfyUI가 작업을 접수해 대기열에 넣었습니다',
'jobst.comfyQueuedAhead': 'ComfyUI가 접수함 — 앞에 {n}개 대기',
'jobst.comfyRunning': '실행 중',
'jobst.comfyRunningDetail': 'ComfyUI가 실행 중입니다',
'jobst.saving': '저장 중',
'jobst.savingDetail': 'ComfyUI 결과를 내려받는 중',
'jobst.failed': '실패',
'jobst.cancelled': '취소됨',
'studio.ratioLabel': '화면 비율',
'studio.megapixelsLabel': '메가픽셀',
'studio.outputSize': '출력 {w} × {h}',
'studio.denoiseLabel': '디노이즈',
'studio.errNumber': '‘{label}’은(는) 숫자여야 합니다',
'studio.errInteger': '‘{label}’은(는) 정수여야 합니다',
'studio.errMin': '‘{label}’은(는) {v} 이상이어야 합니다',
'studio.errMax': '‘{label}’은(는) {v} 이하여야 합니다',
'studio.errOption': '‘{label}’ 값이 워크플로 옵션에 없습니다',
'studio.reuseParams': '설정 재사용',
'studio.reusedToast': '이 작업의 설정을 채웠습니다. 수정 후 다시 생성하세요',
'studio.reuseMissingWf': '이 작업의 워크플로가 더 이상 없습니다',
'studio.doneToast': '완료: 파일 {n}개 (ComfyUI 프롬프트 ID {id})',
'studio.dryRunToast': '자리표시자만: Dry-run이 켜져 있어 ComfyUI를 호출하지 않았습니다',
'studio.dryRunNote': 'Dry-run이 켜져 있습니다: 생성은 자리표시자만 쓰고 ComfyUI를 호출하지 않습니다. 설정에서 끌 수 있습니다.',
};
+35
View File
@@ -1760,4 +1760,39 @@ export const zh: Dict = {
'home.errScriptShort': '剧本内容太短,请检查粘贴是否完整(至少 30 字)',
'home.stageProgress': '五段进度',
'tasks.sourceWorkbench': '创作流程',
'jobst.idSuffix': ' · ComfyUI 任务 ID {id}',
'jobst.done': '完成',
'jobst.doneDetail': 'ComfyUI 已执行完成,结果已保存',
'jobst.dryRun': '占位结果',
'jobst.dryRunDetail': '占位结果:当前开启了 Dry-run,没有调用 ComfyUI,不是真实生成',
'jobst.noOutput': '无产出',
'jobst.noOutputDetail': '任务结束但没有任何结果文件,不算生成完成',
'jobst.queued': '排队中',
'jobst.queuedDetail': '在工作台队列中等待提交到 ComfyUI',
'jobst.connecting': '连接中',
'jobst.connectingDetail': '正在连接 ComfyUI 并上传素材',
'jobst.comfyQueued': '已接收',
'jobst.comfyQueuedDetail': 'ComfyUI 已接收,排队等待执行',
'jobst.comfyQueuedAhead': 'ComfyUI 已接收,前面还有 {n} 个任务',
'jobst.comfyRunning': '执行中',
'jobst.comfyRunningDetail': 'ComfyUI 正在执行',
'jobst.saving': '保存中',
'jobst.savingDetail': 'ComfyUI 已出结果,正在下载保存',
'jobst.failed': '失败',
'jobst.cancelled': '已取消',
'studio.ratioLabel': '画面比例',
'studio.megapixelsLabel': '总像素(百万)',
'studio.outputSize': '输出 {w} × {h}',
'studio.denoiseLabel': '降噪',
'studio.errNumber': '「{label}」必须是数字',
'studio.errInteger': '「{label}」必须是整数',
'studio.errMin': '「{label}」不能小于 {v}',
'studio.errMax': '「{label}」不能大于 {v}',
'studio.errOption': '「{label}」的取值不在工作流支持的选项中',
'studio.reuseParams': '复用参数',
'studio.reusedToast': '已回填该任务的参数,可修改后重新生成',
'studio.reuseMissingWf': '该任务使用的工作流已不存在,无法回填',
'studio.doneToast': '生成完成:{n} 个文件(ComfyUI 任务 ID {id})',
'studio.dryRunToast': '占位完成:当前开启了 Dry-run,没有调用 ComfyUI,结果不是真实生成',
'studio.dryRunNote': '已开启 Dry-run:点生成只会写占位文件,不会调用 ComfyUI。可在「设置」中关闭。',
};
+12 -7
View File
@@ -8,14 +8,14 @@ import { t } from './i18n.svelte';
* Backend reality (see calliope-backend/src/calliope/queue/worker.py):
* - `job.created` { job_id, kind, ... }
* - `job.started` { job_id, kind, message } ← message = job label
* - `job.progress` { prompt_id, message } ← NO job_id, NO percent
* - `job.progress` { job_id, prompt_id, phase, queue_ahead, message } ← NO percent
* - `job.completed` { job_id, outputs, message }
* - `job.failed` { job_id, error, message }
* - `job.deleted` { job_id }
*
* Because progress ticks carry neither a job id nor a percent, the store:
* 1. Attributes a tick to the currently running job (tracked from job.started;
* explicit `job_id` wins if a future backend sends one).
* Because progress ticks carry no percent (and ticks without a job id exist), the store:
* 1. Attributes a tick to its `job_id`, else to the currently running job
* (tracked from job.started).
* 2. Honors a numeric payload field (`progress` / `percent` / `value`, 0–1 or
* 0–100) when present, otherwise synthesizes an asymptotic value that
* approaches TICK_CAP but never reaches it — only job.completed sets 100.
@@ -32,6 +32,10 @@ export type JobProgressEntry = {
progress: number;
/** Latest human-readable status line from the worker. */
message?: string;
/** Worker phase from job.progress (comfy_queued / comfy_running …). */
phase?: string;
/** Prompts ahead of this one in ComfyUI's own queue (comfy_queued only). */
queueAhead?: number | null;
/** True once the job reached a terminal state (done/failed). */
final: boolean;
/** Terminal status when final: 'done' | 'failed'. */
@@ -115,6 +119,8 @@ class JobProgressStore {
this.map.set(id, {
progress,
message: str(d.message) || prev?.message,
phase: str(d.phase) || prev?.phase,
queueAhead: d.queue_ahead === undefined ? prev?.queueAhead : num(d.queue_ahead),
final: false,
updatedAt: Date.now(),
});
@@ -151,9 +157,8 @@ class JobProgressStore {
}
/**
* Today's job.progress payload is {prompt_id, message} with no job id.
* Attribute the tick to the only running job, else the most recently
* started one. Explicit job_id wins when a backend sends it.
* Explicit job_id wins; a tick without one goes to the only running job,
* else the most recently started one.
*/
private resolveJobId(d: Record<string, unknown>): number | null {
const explicit = num(d.job_id);
+53
View File
@@ -0,0 +1,53 @@
import type { Job } from './comfy/types';
import { progressFor } from './jobProgress';
import { t } from './i18n.svelte';
export type JobStatusTone = 'ok' | 'run' | 'queue' | 'fail';
export interface JobStatusInfo {
tone: JobStatusTone;
/** Short label for status columns. */
label: string;
/** Full sentence for the task card / tooltip. */
detail: string;
}
/**
* What a generation job really is — "done" only when ComfyUI returned files.
* A dry-run placeholder or a done row without outputs never reads as done.
*/
export function jobStatusInfo(job: Job): JobStatusInfo {
const live = progressFor(job.id);
const phase = live?.phase ?? job.phase ?? null;
const idSuffix = job.comfy_prompt_id ? t('jobst.idSuffix', { id: job.comfy_prompt_id }) : '';
switch (job.status) {
case 'done':
if (phase === 'dry_run')
return { tone: 'queue', label: t('jobst.dryRun'), detail: t('jobst.dryRunDetail') };
if (!(job.output_paths?.length ?? 0))
return { tone: 'fail', label: t('jobst.noOutput'), detail: t('jobst.noOutputDetail') };
return { tone: 'ok', label: t('jobst.done'), detail: t('jobst.doneDetail') + idSuffix };
case 'pending':
return { tone: 'queue', label: t('jobst.queued'), detail: t('jobst.queuedDetail') };
case 'running':
if (phase === 'comfy_queued') {
const ahead = live?.queueAhead;
const detail =
ahead != null && ahead > 0
? t('jobst.comfyQueuedAhead', { n: ahead })
: t('jobst.comfyQueuedDetail');
return { tone: 'queue', label: t('jobst.comfyQueued'), detail: detail + idSuffix };
}
if (phase === 'comfy_running')
return { tone: 'run', label: t('jobst.comfyRunning'), detail: t('jobst.comfyRunningDetail') + idSuffix };
if (phase === 'saving')
return { tone: 'run', label: t('jobst.saving'), detail: t('jobst.savingDetail') + idSuffix };
return { tone: 'run', label: t('jobst.connecting'), detail: t('jobst.connectingDetail') };
default:
return {
tone: 'fail',
label: job.error === 'cancelled' ? t('jobst.cancelled') : t('jobst.failed'),
detail: job.error ?? t('jobst.failed'),
};
}
}