fix: untagged ComfyUI workflows expose inputs; studio generate always gives feedback (HEL-623)

Root cause: parse_dynamic_inputs only recognised (Input:role) title tags.
A workflow exported straight from ComfyUI has default titles, so its
input_schema was empty and the studio form rendered no prompt box; the
generate click then enqueued (or was blocked) with no toast at all.

- parser: untagged fallback detects prompt/negative (via wiring to
  sampler positive/negative), seed/steps/cfg, latent width/height/batch,
  numeric primitives, LoadImage/LoadImageMask/video/audio slots; only the
  prompt is required; entries carry auto=true
- patcher: "<nodeId>@<widget>" keys target one widget on multi-widget
  nodes, never overwrite linked inputs; LoadImageMask uploads like images
- workflows API re-derives an empty stored schema (old imports fixed
  without re-import); smart_fill sort accepts subgraph/field ids
- studio: blocked submit toasts the reason and scrolls to the field;
  success toasts "已提交"; submit errors show the API detail; job.failed
  for this window's jobs toasts the reason; no-param workflows show a
  note + disabled prompt box; auto-detected params show a note
- connections import: chip shows node count, toast reports real params
- Chinese messages for ComfyUI rejection/upload/timeout/execution errors
  and playground workflow-not-found/disabled
- tests: native Qwen t2i / Qwen edit+mask / untagged H3 fixtures, patch
  keys, backfill, full fake-ComfyUI chain, Chinese rejection

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
shigongyuan-agent
2026-09-28 18:25:41 +08:00
co-authored by multica-agent
parent 1a7a682cd0
commit 063a3c7063
25 changed files with 1705 additions and 35 deletions
@@ -7,8 +7,18 @@
import ImageLightbox from '$lib/components/ImageLightbox.svelte';
import MediaSlot from '$lib/components/studio/MediaSlot.svelte';
import { toStore } from 'svelte/store';
import { tick } from 'svelte';
import AppShell from '$lib/components/shell/AppShell.svelte';
import { assetUrl, comfy, jobsApi, playgroundApi, settings, workflows, type Job } from '$lib/api';
import {
apiErrorMessage,
assetUrl,
comfy,
jobsApi,
playgroundApi,
settings,
workflows,
type Job,
} from '$lib/api';
import type { ComfyDynamicInput } from '$lib/comfy/types';
import { compactInputValues, isPromptLikeInput } from '$lib/comfy/promptInput';
import { parseDbTs } from '$lib/dbtime';
@@ -67,10 +77,20 @@
.flatMap((j) => j.output_paths.map((p) => ({ job: j, path: p, key: `${j.id}:${p}` }))),
);
// Jobs enqueued from this window — a fast failure can land before the
// jobs list refetch knows about them.
const submittedIds = new Set<number>();
// Live progress via SSE + fallback polling.
$effect(() => {
const off = connectEvents((ev) => {
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)) {
toast.error(t('studio.jobFailedToast', { detail: String(ev.data.error ?? '') }));
}
}
if (ev.type.startsWith('job.') || ev.type === 'events.resync') {
void client.invalidateQueries({ queryKey: ['playground-jobs'] });
void client.invalidateQueries({ queryKey: ['jobs'] });
@@ -350,8 +370,21 @@
// Submit
// ------------------------------------------------------------------
async function submit() {
if (submitting) return;
showErrors = true;
if (Object.keys(errors).length || !workflowId || submitting) return;
if (!workflowId) {
toast.error(t('studio.errNoWorkflow'));
return;
}
const blocking = Object.values(errors).find((m) => m.trim());
if (blocking) {
toast.error(t('studio.errBlocked', { reason: blocking }));
await tick();
document
.querySelector('.param-col .invalid, .param-col .f-error')
?.scrollIntoView({ block: 'center', behavior: 'smooth' });
return;
}
submitting = true;
try {
const res = await playgroundApi.generate({
@@ -360,12 +393,13 @@
endpoint_id: endpointId || null,
source: kind === 'image' ? 'studio-image' : 'studio-video',
});
submittedIds.add(res.job.id);
selectedKey = null;
toast.success(t('studio.queuedToast', { name: selectedEndpointName || '—' }));
await client.invalidateQueries({ queryKey: ['playground-jobs'] });
await client.invalidateQueries({ queryKey: ['jobs'] });
void res;
} catch (err) {
toast.error(err instanceof Error ? err.message : String(err));
toast.error(t('studio.submitFailedToast', { detail: apiErrorMessage(err) }));
} finally {
submitting = false;
}
@@ -715,6 +749,11 @@
<option value={wf.id}>{wf.name}</option>
{/each}
</select>
{#if currentWorkflow && !schema.length}
<p class="missing-note">{t('studio.wfNoParamsNote')}</p>
{:else if schema.some((i) => i.auto)}
<p class="missing-note">{t('studio.wfAutoParamsNote', { n: schema.length })}</p>
{/if}
</div>
{#if mediaSlots.length}
@@ -781,6 +820,16 @@
<span class="f-error">{errors[promptInp.nodeId]}</span>
{/if}
</label>
{:else if currentWorkflow}
<label class="f-field">
<span class="f-label">{t('studio.promptLabel')}</span>
<textarea
class="f-input prompt-area"
rows="3"
disabled
placeholder={t('studio.promptNotDeclared')}
></textarea>
</label>
{/if}
<div class="pair-row">