feat: standalone image/video studio windows + generation tasks page (HEL-612)

- /image and /video pages (a3/a4): three-column layout — params (connection,
  workflow, upload slots driven by declared inputs, prompt/negative/seed/
  size/duration fields, dynamic params), current-task card with live SSE
  progress + cancel, result grid with zoom/send-to-img2img/download, video
  player with custom amber controls + first/last-frame strip, right history
  with retry/delete and failure reasons
- /tasks page: both task classes summarized with source labels
  (独立生图/独立生视频/Playground/创作流程), filters, retry/cancel/delete
- nav: 生图/生视频/生成任务 real pages with active-jobs badge (进行数徽章)
- playground generate accepts source (studio-image/studio-video) for origin
  labeling; api.ts types follow
- parseDbTs helper: UTC-naive backend timestamps parse as UTC so elapsed/
  ETA/duration math is offset-correct
- backend tests: full-chain fake-ComfyUI server — image chain, video chain
  with frame uploads, retry-after-failure, delete-removes-outputs, tasks
  listing; i18n zh/en/es/fr/de/ja/ko complete

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
shigongyuan-agent
2026-09-28 09:47:48 +08:00
co-authored by multica-agent
parent 1cf9188955
commit df84c22143
17 changed files with 4306 additions and 10 deletions
@@ -3,7 +3,7 @@
import LanguageSwitcher from '$lib/components/LanguageSwitcher.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import type { IconName } from '$lib/components/ui/icons';
import { settings } from '$lib/api';
import { settings, jobsApi } from '$lib/api';
import { t } from '$lib/i18n.svelte';
/**
@@ -39,9 +39,9 @@
const NAV: NavItem[] = [
{ id: 'projects', labelKey: 'shell.navProjects', icon: 'home', href: '/' },
{ id: 'workbench', labelKey: 'shell.navWorkbench', icon: 'story', href: '/canvas' },
{ id: 'image', labelKey: 'shell.navImage', icon: 'image', wip: true },
{ id: 'video', labelKey: 'shell.navVideo', icon: 'film', wip: true },
{ id: 'tasks', labelKey: 'shell.navTasks', icon: 'queue', wip: true },
{ id: 'image', labelKey: 'shell.navImage', icon: 'image', href: '/image' },
{ id: 'video', labelKey: 'shell.navVideo', icon: 'film', href: '/video' },
{ id: 'tasks', labelKey: 'shell.navTasks', icon: 'queue', href: '/tasks' },
{ id: 'agents', labelKey: 'shell.navAgents', icon: 'sparkle', href: '/agents' },
{ id: 'connections', labelKey: 'shell.navConnections', icon: 'link', href: '/connections' },
{ id: 'models', labelKey: 'shell.navModels', icon: 'assets', href: '/models' },
@@ -67,6 +67,20 @@
staleTime: 60_000,
});
// 生成任务 badge: how many jobs are queued or running right now
// (spec §3 — 进行数徽章). Polled lightly; SSE-driven pages keep
// their own faster cadence.
const activeJobsQuery = createQuery({
queryKey: ['jobs', 'active-count'],
queryFn: () => jobsApi.list(),
refetchInterval: 8_000,
staleTime: 5_000,
});
const activeJobs = $derived(
($activeJobsQuery.data ?? []).filter((j) => j.status === 'pending' || j.status === 'running')
.length,
);
// The ACTIVE ComfyUI connection from settings (HEL-611). The dot stays
// neutral — a passing test is only claimed on the connections page,
// where it comes from a real server-side probe.
@@ -115,9 +129,12 @@
href={item.href}
aria-current={active === item.id ? 'page' : undefined}
>
<span class="nav-icon"><Icon name={item.icon} size={17} /></span>
<span class="nav-label">{t(item.labelKey)}</span>
</a>
<span class="nav-icon"><Icon name={item.icon} size={17} /></span>
<span class="nav-label">{t(item.labelKey)}</span>
{#if item.id === 'tasks' && activeJobs > 0}
<span class="nav-badge">{activeJobs}</span>
{/if}
</a>
{:else}
<span class="nav-item disabled" title={t('shell.wipHint')} aria-disabled="true">
<span class="nav-icon"><Icon name={item.icon} size={17} /></span>
@@ -275,6 +292,21 @@
white-space: nowrap;
}
/* 进行数徽章 (spec §3): accent-dim capsule with amber count */
.nav-badge {
margin-left: auto;
min-width: 20px;
padding: 1px 7px;
border-radius: 999px;
background: var(--accent-dim);
color: var(--accent);
font-size: 10.5px;
font-weight: 600;
font-variant-numeric: tabular-nums;
text-align: center;
line-height: 1.5;
}
.side-foot {
margin-top: auto;
display: flex;
@@ -410,6 +442,23 @@
.wip-pill {
display: none;
}
/* icon-only rail: the tasks badge collapses to a small amber dot */
.nav-item {
position: relative;
}
.nav-badge {
position: absolute;
top: 3px;
right: 5px;
min-width: 6px;
width: 6px;
height: 6px;
padding: 0;
border-radius: 50%;
background: var(--accent);
font-size: 0;
line-height: 0;
}
/* icon-only rail: a small dot marks unbuilt entries */
.nav-item.disabled .nav-icon {
position: relative;