feat(studio): 三种图片输入工作流与最多九张参考图 (HEL-633)
- 解析:H3 参考生视频 ref_images 自增输入收拢为 1–9 张有序参考图组; 图生视频首/尾帧、Qwen 编辑输入图按真实连线识别,未连线不出槽位; Qwen 编辑模式暴露 resolution - 打补丁:按张数克隆/复用/删除 LoadImage 并按序接线 ref_image_0..N-1 - 校验:参考图上限 9、至少 1 张、格式/存在性;必填图片槽位 - 工作流体检:缺 class_type / 断链 / 采样器无模型 → 导入时中文告警, 生成接口与 worker 拒绝执行并提示重新导出 - 前端:RefImageGrid(逐张添加/预览/替换/删除/序号/超限整批拒绝)、 MediaSlot 横排已选态、分辨率字段、损坏工作流提示、连接页告警标签 - 测试:三份真实 JSON + 1/4/9 张参考图全链路 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
60c043db7c
commit
30e8e85766
@@ -6,6 +6,8 @@
|
||||
import Modal from '$lib/components/ui/Modal.svelte';
|
||||
import ImageLightbox from '$lib/components/ImageLightbox.svelte';
|
||||
import MediaSlot from '$lib/components/studio/MediaSlot.svelte';
|
||||
import RefImageGrid from '$lib/components/studio/RefImageGrid.svelte';
|
||||
import { imageFileProblem } from '$lib/comfy/imageFile';
|
||||
import { toStore } from 'svelte/store';
|
||||
import { tick } from 'svelte';
|
||||
import AppShell from '$lib/components/shell/AppShell.svelte';
|
||||
@@ -123,7 +125,14 @@
|
||||
let endpointTouched = $state(false);
|
||||
let endpointId = $state('');
|
||||
let workflowId = $state<number | null>(null);
|
||||
let values = $state<Record<string, string | number>>({});
|
||||
type FormValue = string | number | string[];
|
||||
let values = $state<Record<string, FormValue>>({});
|
||||
/** Per-slot rejected picks (format / size) — shown in place, never uploaded. */
|
||||
let slotRejects = $state<Record<string, Array<{ name: string; message: string }>>>({});
|
||||
/** Byte size of files uploaded here, by server path (for the slot meta line). */
|
||||
let fileSizes = $state<Record<string, number>>({});
|
||||
/** Reference index being replaced while its upload runs. */
|
||||
let replacingIndex = $state(-1);
|
||||
let showErrors = $state(false);
|
||||
let submitting = $state(false);
|
||||
let lightboxOpen = $state(false);
|
||||
@@ -163,13 +172,14 @@
|
||||
}
|
||||
if (wf.id === lastWfId) return;
|
||||
lastWfId = wf.id;
|
||||
const next: Record<string, string | number> = {};
|
||||
const next: Record<string, FormValue> = {};
|
||||
for (const inp of wf.input_schema ?? []) {
|
||||
if (inp.defaultValue !== undefined && inp.defaultValue !== '') {
|
||||
next[inp.nodeId] = inp.defaultValue;
|
||||
}
|
||||
}
|
||||
values = next;
|
||||
slotRejects = {};
|
||||
showErrors = false;
|
||||
});
|
||||
|
||||
@@ -186,13 +196,36 @@
|
||||
return `${inp.role ?? ''} ${inp.label}`.toLowerCase();
|
||||
}
|
||||
const isMedia = (inp: ComfyDynamicInput) =>
|
||||
inp.kind === 'image' || inp.kind === 'image_url' || inp.kind === 'video' || inp.kind === 'audio';
|
||||
inp.kind === 'image' ||
|
||||
inp.kind === 'image_url' ||
|
||||
inp.kind === 'video' ||
|
||||
inp.kind === 'audio' ||
|
||||
inp.kind === 'image_list';
|
||||
// Auto-detected slots carry their role from the wiring; tagged (Input:…)
|
||||
// workflows still name frames only in the title.
|
||||
const isFirstFrame = (inp: ComfyDynamicInput) =>
|
||||
role(inp) === 'first_frame' || (!inp.auto && kind === 'video' && /first|start|首帧/.test(hay(inp)));
|
||||
const isLastFrame = (inp: ComfyDynamicInput) =>
|
||||
role(inp) === 'last_frame' || (!inp.auto && kind === 'video' && /last|end|尾帧/.test(hay(inp)));
|
||||
|
||||
// ComfyUI Autogrow reference images (H3 ref_images): one ordered 1…max list.
|
||||
const refGroup = $derived(schema.find((i) => i.kind === 'image_list') ?? null);
|
||||
const refMax = $derived(refGroup?.max ?? 9);
|
||||
const refPaths = $derived.by(() => {
|
||||
const v = refGroup ? values[refGroup.nodeId] : undefined;
|
||||
if (Array.isArray(v)) return v;
|
||||
return typeof v === 'string' && v ? [v] : [];
|
||||
});
|
||||
const brokenReasons = $derived(
|
||||
(currentWorkflow?.warnings ?? []).filter((w) => w.level === 'error').map((w) => w.message),
|
||||
);
|
||||
|
||||
const promptInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'prompt') ?? null);
|
||||
const negInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'negative') ?? null);
|
||||
const seedInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'seed') ?? null);
|
||||
const widthInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'width') ?? null);
|
||||
const heightInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'height') ?? null);
|
||||
const resolutionInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'resolution') ?? null);
|
||||
const durationInp = $derived(schema.find((i) => !isMedia(i) && role(i) === 'duration') ?? null);
|
||||
const stepsInp = $derived(schema.find((i) => /步数|steps/.test(hay(i)) && !isMedia(i)) ?? null);
|
||||
const cfgInp = $derived(
|
||||
@@ -220,38 +253,80 @@
|
||||
mediaKind: 'image' | 'video' | 'audio';
|
||||
aspect: 'square' | 'wide';
|
||||
fromResults: boolean;
|
||||
/** Required-slot message when left empty (ref-upload-spec §3). */
|
||||
missing: string;
|
||||
emptyText?: string;
|
||||
}
|
||||
|
||||
const mediaSlots = $derived.by(() => {
|
||||
const media = schema.filter(isMedia);
|
||||
const media = schema.filter((i) => isMedia(i) && i.kind !== 'image_list');
|
||||
const plainImages = media.filter(
|
||||
(i) => i.kind === 'image' && role(i) !== 'mask' && !/mask|遮罩/.test(hay(i)) && !isFirstFrame(i) && !isLastFrame(i),
|
||||
);
|
||||
const editInput = kind === 'image' && plainImages.length === 1 ? plainImages[0] : null;
|
||||
const out: SlotDef[] = [];
|
||||
let refIdx = 0;
|
||||
for (const inp of media) {
|
||||
const h = hay(inp);
|
||||
const base = { inp, missing: '' };
|
||||
if (inp.kind === 'video') {
|
||||
out.push({ inp, label: t('studio.slotRefVideo'), mediaKind: 'video', aspect: 'square', fromResults: false });
|
||||
out.push({ ...base, label: t('studio.slotRefVideo'), mediaKind: 'video', aspect: 'square', fromResults: false });
|
||||
} else if (inp.kind === 'audio') {
|
||||
out.push({ inp, label: t('studio.slotAudio'), mediaKind: 'audio', aspect: 'square', fromResults: false });
|
||||
} else if (/mask|遮罩/.test(h)) {
|
||||
out.push({ inp, label: t('studio.slotMask'), mediaKind: 'image', aspect: 'square', fromResults: false });
|
||||
} else if (kind === 'video' && /first|start|首帧/.test(h)) {
|
||||
out.push({ inp, label: t('studio.slotFirst'), mediaKind: 'image', aspect: 'wide', fromResults: true });
|
||||
} else if (kind === 'video' && /last|end|尾帧/.test(h)) {
|
||||
out.push({ inp, label: t('studio.slotLast'), mediaKind: 'image', aspect: 'wide', fromResults: true });
|
||||
out.push({ ...base, label: t('studio.slotAudio'), mediaKind: 'audio', aspect: 'square', fromResults: false });
|
||||
} else if (role(inp) === 'mask' || /mask|遮罩/.test(h)) {
|
||||
out.push({ ...base, label: t('studio.slotMask'), mediaKind: 'image', aspect: 'square', fromResults: false });
|
||||
} else if (isFirstFrame(inp)) {
|
||||
out.push({
|
||||
...base,
|
||||
label: t('studio.slotFirst'),
|
||||
mediaKind: 'image',
|
||||
aspect: 'wide',
|
||||
fromResults: true,
|
||||
missing: t('studio.errNeedFirstFrame'),
|
||||
emptyText: t('studio.slotEmptyFirst'),
|
||||
});
|
||||
} else if (isLastFrame(inp)) {
|
||||
out.push({ ...base, label: t('studio.slotLast'), mediaKind: 'image', aspect: 'wide', fromResults: true });
|
||||
} else if (inp === editInput) {
|
||||
out.push({
|
||||
...base,
|
||||
label: t('studio.slotInput'),
|
||||
mediaKind: 'image',
|
||||
aspect: 'square',
|
||||
fromResults: false,
|
||||
missing: t('studio.errNeedInputImage'),
|
||||
emptyText: t('studio.slotEmptyInput'),
|
||||
});
|
||||
} else {
|
||||
refIdx += 1;
|
||||
const label = inp.auto
|
||||
? inp.label
|
||||
: refIdx === 1 && media.length === 1
|
||||
? t('studio.slotRef')
|
||||
: t('studio.slotRefN', { n: refIdx });
|
||||
out.push({
|
||||
inp,
|
||||
label: refIdx === 1 && media.length === 1 ? t('studio.slotRef') : t('studio.slotRefN', { n: refIdx }),
|
||||
...base,
|
||||
label,
|
||||
mediaKind: 'image',
|
||||
aspect: kind === 'video' ? 'wide' : 'square',
|
||||
fromResults: kind === 'video',
|
||||
missing: t('studio.errUpload', { label }),
|
||||
});
|
||||
}
|
||||
}
|
||||
return out;
|
||||
});
|
||||
|
||||
/** Mode badge from what the workflow really wires (spec §1 table). */
|
||||
const modeLabel = $derived.by(() => {
|
||||
if (refGroup) return t('studio.modeRefToVideo');
|
||||
if (mediaSlots.some((s) => isFirstFrame(s.inp))) return t('studio.modeImageToVideo');
|
||||
if (kind === 'image' && mediaSlots.some((s) => s.mediaKind === 'image' && role(s.inp) !== 'mask'))
|
||||
return t('studio.modeImageEdit');
|
||||
if (mediaSlots.length) return mediaSlots.map((s) => s.label).join(' · ');
|
||||
return kind === 'image' ? t('studio.modeTextToImage') : t('studio.modeTextToVideo');
|
||||
});
|
||||
|
||||
const structuredIds = $derived(
|
||||
new Set(
|
||||
[
|
||||
@@ -260,6 +335,7 @@
|
||||
seedInp,
|
||||
widthInp,
|
||||
heightInp,
|
||||
resolutionInp,
|
||||
durationInp,
|
||||
stepsInp,
|
||||
cfgInp,
|
||||
@@ -314,8 +390,9 @@
|
||||
if (!v.trim()) errs[promptInp.nodeId] = t('studio.errPrompt');
|
||||
else if (v.length > 2000) errs[promptInp.nodeId] = t('studio.errPromptLong');
|
||||
}
|
||||
const first = mediaSlots.find((s) => /first|start|首帧/.test(hay(s.inp)));
|
||||
const last = mediaSlots.find((s) => /last|end|尾帧/.test(hay(s.inp)));
|
||||
if (brokenReasons.length) errs.workflow = t('studio.errWfBroken');
|
||||
const first = mediaSlots.find((s) => isFirstFrame(s.inp));
|
||||
const last = mediaSlots.find((s) => isLastFrame(s.inp));
|
||||
if (first && last) {
|
||||
const a = String(values[first.inp.nodeId] ?? '');
|
||||
const b = String(values[last.inp.nodeId] ?? '');
|
||||
@@ -328,14 +405,14 @@
|
||||
for (const s of mediaSlots) {
|
||||
if (!s.inp.required) continue;
|
||||
if (!String(values[s.inp.nodeId] ?? '').trim()) {
|
||||
const isPlainRef = kind === 'image' && !/mask|遮罩|first|start|首帧|last|end|尾帧/.test(hay(s.inp));
|
||||
errs[s.inp.nodeId] =
|
||||
mediaSlots.filter((x) => x.mediaKind === 'image' && !/mask|遮罩/.test(hay(x.inp))).length === 1 &&
|
||||
isPlainRef
|
||||
? t('studio.errRefImage')
|
||||
: t('studio.errUpload', { label: s.label });
|
||||
errs[s.inp.nodeId] = s.missing || t('studio.errUpload', { label: s.label });
|
||||
}
|
||||
}
|
||||
if (refGroup) {
|
||||
if (refPaths.length < (refGroup.min ?? 1)) errs[refGroup.nodeId] = t('studio.errNeedRef');
|
||||
else if (refPaths.length > refMax)
|
||||
errs[refGroup.nodeId] = t('studio.errRefMax', { max: refMax, n: refPaths.length, k: refPaths.length - refMax });
|
||||
}
|
||||
for (const inp of restInputs) {
|
||||
if (inp.required && !String(values[inp.nodeId] ?? '').trim()) {
|
||||
errs[inp.nodeId] = t('studio.errFill', { label: inp.label });
|
||||
@@ -343,7 +420,7 @@
|
||||
}
|
||||
for (const inp of schema) {
|
||||
const raw = values[inp.nodeId];
|
||||
if (raw === undefined || String(raw).trim() === '' || errs[inp.nodeId]) continue;
|
||||
if (raw === undefined || Array.isArray(raw) || String(raw).trim() === '' || errs[inp.nodeId]) continue;
|
||||
const msg = valueError(inp, raw);
|
||||
if (msg) errs[inp.nodeId] = msg;
|
||||
}
|
||||
@@ -367,7 +444,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
function setVal(nodeId: string, v: string | number) {
|
||||
function setVal(nodeId: string, v: FormValue) {
|
||||
values = { ...values, [nodeId]: v };
|
||||
}
|
||||
function numVal(nodeId: string, raw: string) {
|
||||
@@ -382,11 +459,72 @@
|
||||
// ------------------------------------------------------------------
|
||||
// Uploads & media slots
|
||||
// ------------------------------------------------------------------
|
||||
async function slotFile(nodeId: string, file: File) {
|
||||
function setRejects(nodeId: string, list: Array<{ name: string; message: string }>) {
|
||||
slotRejects = { ...slotRejects, [nodeId]: list };
|
||||
}
|
||||
|
||||
async function uploadImage(nodeId: string, file: File): Promise<string | null> {
|
||||
const path = await uploads.uploadSafe(nodeId, file);
|
||||
if (path) fileSizes = { ...fileSizes, [path]: file.size };
|
||||
return path;
|
||||
}
|
||||
|
||||
async function slotFile(nodeId: string, file: File, mediaKind: 'image' | 'video' | 'audio' = 'image') {
|
||||
if (mediaKind === 'image') {
|
||||
const problem = imageFileProblem(file);
|
||||
if (problem) {
|
||||
setRejects(nodeId, [{ name: file.name, message: problem }]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setRejects(nodeId, []);
|
||||
const path = await uploadImage(nodeId, file);
|
||||
if (path) setVal(nodeId, path);
|
||||
}
|
||||
|
||||
/** Add picked/dropped files in order; a batch that would pass `max` is refused whole. */
|
||||
async function refAdd(files: File[]) {
|
||||
if (!refGroup) return;
|
||||
const key = refGroup.nodeId;
|
||||
const ok = files.filter((f) => !imageFileProblem(f));
|
||||
const rejected = files
|
||||
.filter((f) => imageFileProblem(f))
|
||||
.map((f) => ({ name: f.name, message: imageFileProblem(f)! }));
|
||||
setRejects(key, rejected);
|
||||
if (refPaths.length + ok.length > refMax) {
|
||||
toast.error(t('studio.errRefMax', { max: refMax, n: refPaths.length, k: ok.length }));
|
||||
return;
|
||||
}
|
||||
for (const f of ok) {
|
||||
const path = await uploadImage(key, f);
|
||||
if (!path) break;
|
||||
setVal(key, [...refPaths, path]);
|
||||
}
|
||||
}
|
||||
|
||||
async function refReplace(index: number, file: File) {
|
||||
if (!refGroup) return;
|
||||
const key = refGroup.nodeId;
|
||||
const problem = imageFileProblem(file);
|
||||
if (problem) {
|
||||
setRejects(key, [{ name: file.name, message: problem }]);
|
||||
return;
|
||||
}
|
||||
setRejects(key, []);
|
||||
replacingIndex = index;
|
||||
try {
|
||||
const path = await uploadImage(key, file);
|
||||
if (path) setVal(key, refPaths.map((p, i) => (i === index ? path : p)));
|
||||
} finally {
|
||||
replacingIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function refRemove(index: number) {
|
||||
if (!refGroup) return;
|
||||
setVal(refGroup.nodeId, refPaths.filter((_, i) => i !== index));
|
||||
}
|
||||
|
||||
const imageResults = $derived(
|
||||
allJobs
|
||||
.filter((j) => j.kind === 'image' && jobStatusInfo(j).tone === 'ok')
|
||||
@@ -398,13 +536,18 @@
|
||||
pickerFor = nodeId;
|
||||
}
|
||||
function pickImageResult(path: string) {
|
||||
if (pickerFor) setVal(pickerFor, path);
|
||||
if (pickerFor && refGroup && pickerFor === refGroup.nodeId) {
|
||||
if (refPaths.length >= refMax) toast.error(t('studio.refFull', { max: refMax }));
|
||||
else setVal(pickerFor, [...refPaths, path]);
|
||||
} else if (pickerFor) {
|
||||
setVal(pickerFor, path);
|
||||
}
|
||||
pickerFor = null;
|
||||
}
|
||||
|
||||
function sendToImg2Img(path: string) {
|
||||
let wf = currentWorkflow;
|
||||
let target = mediaSlots.find((s) => s.mediaKind === 'image')?.inp ?? null;
|
||||
let target = mediaSlots.find((s) => s.mediaKind === 'image' && role(s.inp) !== 'mask')?.inp ?? null;
|
||||
if (!target) {
|
||||
const candidate = ($workflowsQuery.data ?? []).find(
|
||||
(w) => w.kind === 'image' && w.is_enabled && (w.input_schema ?? []).some(isMedia),
|
||||
@@ -629,16 +772,24 @@
|
||||
const wf = ($workflowsQuery.data ?? []).find((w) => w.id === selectedEntry.job.workflow_id);
|
||||
if (!wf) return [];
|
||||
const vals = (selectedEntry.job.payload?.input_values ?? {}) as Record<string, unknown>;
|
||||
const out: Array<{ label: string; path: string }> = [];
|
||||
const out: Array<{ label: string; path: string; ref?: boolean }> = [];
|
||||
for (const inp of wf.input_schema ?? []) {
|
||||
const h = `${inp.role ?? ''} ${inp.label}`.toLowerCase();
|
||||
const v = vals[inp.nodeId];
|
||||
if (inp.kind === 'image_list') {
|
||||
const list = Array.isArray(v) ? v : typeof v === 'string' && v ? [v] : [];
|
||||
list.forEach((p, i) => {
|
||||
if (typeof p === 'string') out.push({ label: t('studio.slotRefN', { n: i + 1 }), path: p, ref: true });
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (typeof v !== 'string' || !v) continue;
|
||||
if (/first|start|首帧/.test(h)) out.push({ label: t('studio.slotFirst'), path: v });
|
||||
else if (/last|end|尾帧/.test(h)) out.push({ label: t('studio.slotLast'), path: v });
|
||||
}
|
||||
return out;
|
||||
});
|
||||
const selectedRefCount = $derived(selectedFrames.filter((f) => f.ref).length);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// History actions
|
||||
@@ -650,14 +801,16 @@
|
||||
toast.error(t('studio.reuseMissingWf'));
|
||||
return;
|
||||
}
|
||||
const next: Record<string, string | number> = {};
|
||||
const next: Record<string, FormValue> = {};
|
||||
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;
|
||||
else if (Array.isArray(v) && v.every((p) => typeof p === 'string')) next[k] = v as string[];
|
||||
}
|
||||
slotRejects = {};
|
||||
workflowId = wf.id;
|
||||
lastWfId = wf.id;
|
||||
values = next;
|
||||
@@ -764,13 +917,7 @@
|
||||
<div class="panel-head">
|
||||
<h2>{t('studio.genParams')}</h2>
|
||||
{#if currentWorkflow}
|
||||
<span class="panel-hint">
|
||||
{mediaSlots.length
|
||||
? mediaSlots.map((s) => s.label).join(' · ')
|
||||
: kind === 'image'
|
||||
? t('studio.modeTextToImage')
|
||||
: t('studio.modeTextToVideo')}
|
||||
</span>
|
||||
<span class="panel-hint">{modeLabel}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if dryRun}
|
||||
@@ -839,11 +986,22 @@
|
||||
{:else if schema.some((i) => i.auto)}
|
||||
<p class="missing-note">{t('studio.wfAutoParamsNote', { n: schema.length })}</p>
|
||||
{/if}
|
||||
{#if brokenReasons.length}
|
||||
<div class="missing-note" role="alert">
|
||||
<span class="f-error">{t('studio.wfBrokenTitle')}</span>
|
||||
{#each brokenReasons as reason (reason)}
|
||||
<span class="f-error">· {reason}</span>
|
||||
{/each}
|
||||
<span class="f-error">{t('studio.wfBrokenHint')}</span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if mediaSlots.length}
|
||||
{@const pairKey = `${mediaSlots.find((s) => isFirstFrame(s.inp))?.inp.nodeId ?? ''}|${mediaSlots.find((s) => isLastFrame(s.inp))?.inp.nodeId ?? ''}`}
|
||||
<div class="slots">
|
||||
{#each mediaSlots as s (s.inp.nodeId)}
|
||||
{@const reject = slotRejects[s.inp.nodeId]?.[0]}
|
||||
{#if s.inp.kind === 'video' || s.inp.kind === 'audio'}
|
||||
<div class="slot-span">
|
||||
<MediaSlot
|
||||
@@ -853,7 +1011,7 @@
|
||||
uploading={uploads.isUploading(s.inp.nodeId)}
|
||||
uploadName={uploads.uploading[s.inp.nodeId]}
|
||||
error={showErrors ? errors[s.inp.nodeId] : undefined}
|
||||
onFile={(f) => slotFile(s.inp.nodeId, f)}
|
||||
onFile={(f) => slotFile(s.inp.nodeId, f, s.mediaKind)}
|
||||
onClear={() => setVal(s.inp.nodeId, '')}
|
||||
/>
|
||||
</div>
|
||||
@@ -861,29 +1019,56 @@
|
||||
<div class="slot-cell" class:span2={s.aspect === 'wide' || mediaSlots.length === 1}>
|
||||
<MediaSlot
|
||||
label={s.label}
|
||||
hint={kind === 'video' && s.fromResults ? t('studio.slotFromResults') : undefined}
|
||||
required={s.inp.required}
|
||||
hint={s.fromResults ? t('studio.slotFromResults') : s.inp.required ? t('studio.slotHintOne') : undefined}
|
||||
value={String(values[s.inp.nodeId] ?? '')}
|
||||
kind="image"
|
||||
aspect={s.aspect}
|
||||
emptyText={s.emptyText}
|
||||
emptySub={t('studio.slotEmptySub')}
|
||||
size={fileSizes[String(values[s.inp.nodeId] ?? '')]}
|
||||
uploading={uploads.isUploading(s.inp.nodeId)}
|
||||
uploadName={uploads.uploading[s.inp.nodeId]}
|
||||
error={showErrors ? errors[s.inp.nodeId] : undefined}
|
||||
error={reject?.message ?? (showErrors ? errors[s.inp.nodeId] : undefined)}
|
||||
allowFromResults={s.fromResults}
|
||||
onFile={(f) => slotFile(s.inp.nodeId, f)}
|
||||
onFromResults={() => openPicker(s.inp.nodeId)}
|
||||
onClear={() => setVal(s.inp.nodeId, '')}
|
||||
onClear={() => {
|
||||
setRejects(s.inp.nodeId, []);
|
||||
setVal(s.inp.nodeId, '');
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{#if showErrors && errors[`${mediaSlots.find((s) => /first|start|首帧/.test(hay(s.inp)))?.inp.nodeId ?? ''}|${mediaSlots.find((s) => /last|end|尾帧/.test(hay(s.inp)))?.inp.nodeId ?? ''}`]}
|
||||
<span class="f-error">
|
||||
{errors[`${mediaSlots.find((s) => /first|start|首帧/.test(hay(s.inp)))?.inp.nodeId ?? ''}|${mediaSlots.find((s) => /last|end|尾帧/.test(hay(s.inp)))?.inp.nodeId ?? ''}`]}
|
||||
</span>
|
||||
{#if showErrors && errors[pairKey]}
|
||||
<span class="f-error">{errors[pairKey]}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if refGroup}
|
||||
<div class="f-field">
|
||||
<RefImageGrid
|
||||
label={refGroup.label}
|
||||
paths={refPaths}
|
||||
max={refMax}
|
||||
sizes={fileSizes}
|
||||
uploadingName={uploads.uploading[refGroup.nodeId]}
|
||||
uploadingIndex={replacingIndex}
|
||||
rejects={slotRejects[refGroup.nodeId] ?? []}
|
||||
error={showErrors ? errors[refGroup.nodeId] : undefined}
|
||||
allowFromResults
|
||||
onAdd={refAdd}
|
||||
onReplace={refReplace}
|
||||
onRemove={refRemove}
|
||||
onDismissReject={(i) =>
|
||||
setRejects(refGroup.nodeId, (slotRejects[refGroup.nodeId] ?? []).filter((_, j) => j !== i))}
|
||||
onFromResults={() => openPicker(refGroup.nodeId)}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if promptInp}
|
||||
<label class="f-field">
|
||||
<span class="f-label">
|
||||
@@ -1014,6 +1199,22 @@
|
||||
{@render fieldError(widthInp)}
|
||||
{@render fieldError(heightInp)}
|
||||
</div>
|
||||
{:else if resolutionInp}
|
||||
<label class="f-field">
|
||||
<span class="f-label">{t('studio.resolutionLabel')}</span>
|
||||
<input
|
||||
class="f-input mono"
|
||||
class:invalid={showErrors && errors[resolutionInp.nodeId]}
|
||||
type="number"
|
||||
min={resolutionInp.min}
|
||||
max={resolutionInp.max}
|
||||
step={resolutionInp.step ?? 32}
|
||||
value={String(values[resolutionInp.nodeId] ?? '')}
|
||||
oninput={(e) => numVal(resolutionInp.nodeId, e.currentTarget.value)}
|
||||
/>
|
||||
<span class="panel-hint">{t('studio.resolutionHint')}</span>
|
||||
{@render fieldError(resolutionInp)}
|
||||
</label>
|
||||
{/if}
|
||||
|
||||
{#if stepsInp || cfgInp || denoiseInp || batchInp || durationInp || fpsInp}
|
||||
@@ -1343,7 +1544,9 @@
|
||||
</div>
|
||||
{#if selectedFrames.length}
|
||||
<div class="frame-strip">
|
||||
<span class="strip-label">{t('studio.videoRefStrip')}</span>
|
||||
<span class="strip-label">
|
||||
{selectedRefCount ? t('studio.refStrip', { n: selectedRefCount }) : t('studio.videoRefStrip')}
|
||||
</span>
|
||||
{#each selectedFrames as fr (fr.path)}
|
||||
<div class="frame-item">
|
||||
<img src={assetUrl(fr.path)} alt={fr.label} />
|
||||
|
||||
Reference in New Issue
Block a user