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:
co-authored by
Cursor
multica-agent
parent
0031a897d7
commit
60c043db7c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user