- 新增 components/desk/:StudioDesk 取代 StudioGenerate 成为 /image、/video 共用页面;TaskModeRail(真实计数、未覆盖置灰、收藏/最近)、WorkflowBay (搜索、本机/云端分段、模型家族分组、待确认入口、增量渲染)、 WorkflowPreview(输入要求预览)、LibraryRow/LibraryFilters/ InputRequirementBadge - 挑选时中栏 grid 列宽展开、右侧显示预览;选定后收成摘要带; data-reduce 直接跳变;≤1179px 挑选台为全屏浮层,≤760px 任务模式横条 - 挑选侧全部走 view=meta 轻量元数据,完整记录按 id 惰性加载; 云端来源诚实标注未接入;?wf/?mode 深链;五阶段上下文与返回路径不变 - Composer 工作流芯片改为展开挑选台,删除 WorkflowPicker; i18n 29 键 ×7 语言;changelog - e2e/shoot.mjs 适配挑选台键盘链,并修正 7 处 S1 灰阶化后失效的 旧色值/文案断言(定影 + theme-1 灰阶信号色) Co-authored-by: multica-agent <github@multica.ai>
248 lines
5.8 KiB
Svelte
248 lines
5.8 KiB
Svelte
<script lang="ts">
|
|
import Icon from '$lib/components/ui/Icon.svelte';
|
|
import type { Workflow, WorkflowMeta } from '$lib/comfy/types';
|
|
import { t } from '$lib/i18n.svelte';
|
|
import { usageLabel, slotSummary } from '$lib/components/generate/schema';
|
|
import InputRequirementBadge from './InputRequirementBadge.svelte';
|
|
|
|
/**
|
|
* 输入要求预览 (HEL-683):挑选台打开时右侧的详情面板——展示键盘/指针
|
|
* 停留的工作流的名称、家族、说明与真实输入要求(S2 元数据 + 已加载的
|
|
* 完整记录槽位摘要),确认后进入创作区。
|
|
*/
|
|
interface Props {
|
|
meta: WorkflowMeta | null;
|
|
full: Workflow | null;
|
|
currentId: number | null;
|
|
endpoints: Array<{ id: string; name: string }>;
|
|
onUse: () => void;
|
|
onToggleFav: (fav: boolean) => void;
|
|
}
|
|
|
|
let { meta, full, currentId, endpoints, onUse, onToggleFav }: Props = $props();
|
|
|
|
const isCurrent = $derived(meta != null && meta.id === currentId);
|
|
const broken = $derived((full?.warnings ?? []).some((w) => w.level === 'error'));
|
|
const endpointName = $derived.by(() => {
|
|
const id = meta?.endpoint_id;
|
|
if (!id) return t('desk.wfDefaultConn');
|
|
return endpoints.find((e) => e.id === id)?.name ?? t('desk.wfDefaultConn');
|
|
});
|
|
const CATEGORY_LABELS: Record<string, string> = {
|
|
basic: 'wfCat.basic',
|
|
audio_tts: 'wfCat.audioTts',
|
|
music: 'wfCat.music',
|
|
image: 'wfCat.image',
|
|
video: 'wfCat.video',
|
|
digital_human: 'wfCat.digitalHuman',
|
|
motion_transfer: 'wfCat.motionTransfer',
|
|
};
|
|
</script>
|
|
|
|
<div class="preview">
|
|
{#if meta}
|
|
<div class="head">
|
|
<h3 class="name" title={meta.name}>{meta.name}</h3>
|
|
<button
|
|
type="button"
|
|
class="fav"
|
|
class:on={meta.favorite}
|
|
aria-pressed={meta.favorite}
|
|
aria-label={t('desk.bayFavOnly')}
|
|
title={meta.favorite ? t('desk.pvUnfav') : t('desk.pvFav')}
|
|
onclick={() => onToggleFav(!meta.favorite)}
|
|
>
|
|
<Icon name="star" size={16} />
|
|
</button>
|
|
</div>
|
|
<div class="tags">
|
|
{#if meta.usage}<span class="a-tag accent">{usageLabel(meta.usage)}</span>{/if}
|
|
{#if meta.model_family}<span class="a-tag">{meta.model_family}</span>{/if}
|
|
{#if meta.category && CATEGORY_LABELS[meta.category]}
|
|
<span class="a-tag">{t(CATEGORY_LABELS[meta.category])}</span>
|
|
{/if}
|
|
{#if isCurrent}<span class="a-tag ok">{t('desk.pvCurrent')}</span>{/if}
|
|
{#if broken}<span class="a-tag err">{t('desk.wfBroken')}</span>{/if}
|
|
</div>
|
|
|
|
{#if meta.description}
|
|
<p class="desc">{meta.description}</p>
|
|
{/if}
|
|
|
|
<section class="sec">
|
|
<h4 class="sec-title">{t('desk.bayReqTitle')}</h4>
|
|
<div class="req-line">
|
|
<InputRequirementBadge io={meta.media_io} />
|
|
</div>
|
|
{#if full}
|
|
<p class="slot-summary">{slotSummary(full)}</p>
|
|
{:else}
|
|
<p class="slot-summary dim">{t('desk.pvSlotsLoading')}</p>
|
|
{/if}
|
|
</section>
|
|
|
|
<dl class="kv">
|
|
<div class="kv-row">
|
|
<dt>{t('studio.connLabel')}</dt>
|
|
<dd>{endpointName}</dd>
|
|
</div>
|
|
{#if meta.last_used_at}
|
|
<div class="kv-row">
|
|
<dt>{t('desk.pvLastUsed')}</dt>
|
|
<dd>{new Date(meta.last_used_at).toLocaleString()}</dd>
|
|
</div>
|
|
{/if}
|
|
{#if (full?.input_schema ?? []).length}
|
|
<div class="kv-row">
|
|
<dt>{t('desk.pvParamCount')}</dt>
|
|
<dd>{(full?.input_schema ?? []).length}</dd>
|
|
</div>
|
|
{/if}
|
|
</dl>
|
|
|
|
<div class="use">
|
|
<button type="button" class="a-btn primary" disabled={broken} onclick={onUse}>
|
|
<Icon name="check" size={13} />
|
|
{isCurrent ? t('desk.pvBackCreate') : t('desk.pvUse')}
|
|
</button>
|
|
{#if broken}<p class="use-hint">{t('studio.errWfBroken')}</p>{/if}
|
|
</div>
|
|
{:else}
|
|
<div class="preview-empty">
|
|
<Icon name="search" size={20} />
|
|
<p>{t('desk.pvEmpty')}</p>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
|
|
<style>
|
|
.preview {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--sp-4);
|
|
flex: 1;
|
|
min-height: 0;
|
|
box-sizing: border-box;
|
|
height: 100%;
|
|
padding: var(--sp-7);
|
|
overflow-y: auto;
|
|
}
|
|
.head {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: var(--sp-3);
|
|
}
|
|
.name {
|
|
flex: 1;
|
|
min-width: 0;
|
|
margin: 0;
|
|
color: var(--text);
|
|
font-size: var(--fs-title);
|
|
font-weight: 600;
|
|
line-height: 1.4;
|
|
overflow-wrap: anywhere;
|
|
}
|
|
.fav {
|
|
flex-shrink: 0;
|
|
display: grid;
|
|
place-items: center;
|
|
width: 32px;
|
|
height: 32px;
|
|
border: 1px solid var(--line);
|
|
border-radius: var(--r-md);
|
|
background: none;
|
|
color: var(--text-3);
|
|
cursor: pointer;
|
|
transition:
|
|
color var(--d-state) ease,
|
|
background-color var(--d-state) ease;
|
|
}
|
|
.fav.on {
|
|
color: var(--accent);
|
|
background: var(--accent-soft);
|
|
}
|
|
.fav:focus-visible {
|
|
outline: none;
|
|
box-shadow: 0 0 0 1px var(--accent-line);
|
|
}
|
|
.tags {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: var(--sp-1);
|
|
}
|
|
.desc {
|
|
margin: 0;
|
|
color: var(--text-2);
|
|
font-size: var(--fs-aux);
|
|
line-height: 1.65;
|
|
white-space: pre-line;
|
|
}
|
|
.sec {
|
|
display: grid;
|
|
gap: var(--sp-2);
|
|
padding: var(--sp-4);
|
|
border: 1px solid var(--line);
|
|
border-radius: var(--r-lg);
|
|
background: var(--bg-2);
|
|
}
|
|
.sec-title {
|
|
margin: 0;
|
|
color: var(--text-3);
|
|
font-size: var(--fs-mini);
|
|
letter-spacing: 0.05em;
|
|
}
|
|
.req-line {
|
|
display: flex;
|
|
}
|
|
.slot-summary {
|
|
margin: 0;
|
|
color: var(--text-2);
|
|
font-size: var(--fs-aux);
|
|
}
|
|
.slot-summary.dim {
|
|
color: var(--text-3);
|
|
}
|
|
.kv {
|
|
display: grid;
|
|
gap: var(--sp-1);
|
|
margin: 0;
|
|
}
|
|
.kv-row {
|
|
display: flex;
|
|
gap: var(--sp-3);
|
|
font-size: var(--fs-aux);
|
|
}
|
|
.kv-row dt {
|
|
flex-shrink: 0;
|
|
width: 72px;
|
|
color: var(--text-3);
|
|
}
|
|
.kv-row dd {
|
|
margin: 0;
|
|
color: var(--text-2);
|
|
min-width: 0;
|
|
overflow-wrap: anywhere;
|
|
}
|
|
.use {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: var(--sp-2);
|
|
margin-top: auto;
|
|
padding-top: var(--sp-4);
|
|
}
|
|
.use-hint {
|
|
margin: 0;
|
|
color: var(--err);
|
|
font-size: var(--fs-mini);
|
|
}
|
|
.preview-empty {
|
|
display: grid;
|
|
place-content: center;
|
|
justify-items: center;
|
|
gap: var(--sp-3);
|
|
height: 100%;
|
|
color: var(--text-3);
|
|
font-size: var(--fs-aux);
|
|
}
|
|
</style>
|