Compare commits

...
17 changed files with 2569 additions and 84 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"test": "node scripts/check-storage-ssr.mjs",
"test": "node scripts/check-storage-ssr.mjs && node scripts/check-random-uuid.mjs",
"lint": "prettier --check . && eslint .",
"format": "prettier --write ."
},
+172
View File
@@ -0,0 +1,172 @@
#!/usr/bin/env node
/**
* Regression guard for the "crypto.randomUUID is not a function" crash.
*
* `crypto.randomUUID()` only exists in secure contexts (HTTPS, localhost,
* 127.0.0.1). On a LAN HTTP page — e.g. http://192.168.200.15:8080 — the
* browser exposes `crypto` WITHOUT `randomUUID`, so any direct call throws
* and model saving dies. `crypto.getRandomValues()` has no secure-context
* requirement, so the shared helper can always mint a proper v4 UUID.
*
* Two layers of protection, mirroring check-storage-ssr.mjs:
* 1. behavioural — lib/ids.ts must produce unique, well-formed v4 UUIDs
* under every crypto shape a browser can present, including the exact
* insecure-context shape that produced the original crash.
* 2. static — direct `crypto.randomUUID(` calls are banned outside
* lib/ids.ts, so the crash cannot be reintroduced by copying the old
* pattern into a new page.
*
* Run with `npm test` (or `node scripts/check-random-uuid.mjs`).
*/
import { readFileSync, readdirSync } from "node:fs";
import { dirname, join, relative } from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
const HERE = dirname(fileURLToPath(import.meta.url));
const ROOT = join(HERE, "..");
const SRC = join(ROOT, "src");
const HELPER = join(SRC, "lib", "ids.ts");
let failures = 0;
function fail(message) {
failures += 1;
console.error(`FAIL ${message}`);
}
function ok(message) {
console.log(`ok ${message}`);
}
const UUID_V4 =
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
/** Capture the platform crypto before any test replaces it. */
const REAL_CRYPTO = globalThis.crypto;
/** Replace the global under test. Node's own binding may be getter-only. */
function setGlobalCrypto(value) {
Object.defineProperty(globalThis, "crypto", {
value,
configurable: true,
writable: true,
});
}
const { randomId } = await import(pathToFileURL(HELPER).href);
// ---- 1. behavioural ----------------------------------------------------
// The exact shape a LAN HTTP browser presents: crypto WITHOUT randomUUID.
// This is the configuration that produced the original crash.
const insecureContextCrypto = {
getRandomValues: REAL_CRYPTO.getRandomValues.bind(REAL_CRYPTO),
};
setGlobalCrypto(insecureContextCrypto);
try {
const ids = new Set(Array.from({ length: 1000 }, randomId));
if (ids.size !== 1000)
fail(`insecure context: duplicate ids (${1000 - ids.size} collisions)`);
else if (![...ids].every((id) => UUID_V4.test(id))) {
fail("insecure context: ids are not all well-formed v4 UUIDs");
} else {
ok("insecure-context crypto (getRandomValues only) yields unique v4 UUIDs");
}
} catch (err) {
fail(`insecure-context crypto threw: ${err.message}`);
}
// crypto present but BOTH sources missing (exotic embed / ancient runtime).
setGlobalCrypto({});
try {
const ids = new Set(Array.from({ length: 1000 }, randomId));
if (ids.size !== 1000)
fail(`method-less crypto: duplicate ids (${1000 - ids.size} collisions)`);
else if (![...ids].every((id) => id.length >= 16)) {
fail("method-less crypto: ids too short to be collision-resistant");
} else {
ok(
"method-less crypto degrades to unique best-effort ids without throwing",
);
}
} catch (err) {
fail(`method-less crypto threw: ${err.message}`);
}
// crypto entirely absent.
setGlobalCrypto(undefined);
try {
const ids = new Set(Array.from({ length: 1000 }, randomId));
if (ids.size !== 1000)
fail(`absent crypto: duplicate ids (${1000 - ids.size} collisions)`);
else ok("absent crypto degrades to unique best-effort ids without throwing");
} catch (err) {
fail(`absent crypto threw: ${err.message}`);
}
// A fully-featured crypto (secure context / Node default) must still be used
// directly — guards against a helper that ignores randomUUID.
setGlobalCrypto(REAL_CRYPTO);
try {
const probe = { used: false };
setGlobalCrypto({
randomUUID: () => {
probe.used = true;
return REAL_CRYPTO.randomUUID();
},
getRandomValues: REAL_CRYPTO.getRandomValues.bind(REAL_CRYPTO),
});
const id = randomId();
if (!probe.used) fail("native randomUUID available but not preferred");
else if (!UUID_V4.test(id)) fail(`secure-context id malformed: ${id}`);
else ok("native randomUUID preferred when available");
} catch (err) {
fail(`secure-context crypto threw: ${err.message}`);
} finally {
setGlobalCrypto(REAL_CRYPTO);
}
// ---- 2. static ---------------------------------------------------------
const UNSAFE = /crypto\.randomUUID\s*\(/;
const EXTENSIONS = [".ts", ".js", ".svelte"];
function walk(dir) {
const found = [];
for (const entry of readdirSync(dir, { withFileTypes: true })) {
const full = join(dir, entry.name);
if (entry.isDirectory()) {
if (entry.name === "node_modules") continue;
found.push(...walk(full));
} else if (EXTENSIONS.some((ext) => entry.name.endsWith(ext))) {
found.push(full);
}
}
return found;
}
const offenders = [];
for (const file of walk(SRC)) {
if (file === HELPER) continue; // the one place allowed to call the native API
const lines = readFileSync(file, "utf8").split("\n");
lines.forEach((line, i) => {
if (UNSAFE.test(line))
offenders.push(`${relative(ROOT, file)}:${i + 1}: ${line.trim()}`);
});
}
if (offenders.length) {
fail(
`direct \`crypto.randomUUID()\` call outside lib/ids.ts — use randomId() instead (insecure contexts crash on it):\n ${offenders.join("\n ")}`,
);
} else {
ok("no direct `crypto.randomUUID()` calls in src/");
}
// ---- result ------------------------------------------------------------
if (failures) {
console.error(`\n${failures} randomId/insecure-context check(s) failed.`);
process.exit(1);
}
console.log("\nrandomId insecure-context checks passed.");
@@ -0,0 +1,469 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
import { assetUrl, projects, type Project } from '$lib/api';
import { toast } from '$lib/toast';
import Button from '$lib/components/ui/Button.svelte';
import ConfirmDialog from '$lib/components/ui/ConfirmDialog.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import Modal from '$lib/components/ui/Modal.svelte';
import { t } from '$lib/i18n.svelte';
/**
* A「片场暗房」project card for the home overview (a1, HEL-608).
* All numbers come from the real project record — no sample progress.
*/
interface Props {
project: Project;
}
let { project }: Props = $props();
const client = useQueryClient();
const stats = $derived(
project.stats ?? {
scene_count: 0,
character_count: 0,
asset_ready_count: 0,
asset_total_count: 0,
},
);
// Spec §2.1 allows the five avatar gradients as cover placeholders.
const PLACEHOLDER_GRADIENTS = [
'linear-gradient(135deg, #e8a33d, #b96a1b)',
'linear-gradient(135deg, #5b8def, #3a5fa9)',
'linear-gradient(135deg, #3fb97f, #2a7a54)',
'linear-gradient(135deg, #b98be0, #7a4fa9)',
'linear-gradient(135deg, #d98e6a, #a95535)',
];
const placeholder = $derived(PLACEHOLDER_GRADIENTS[project.id % PLACEHOLDER_GRADIENTS.length]);
const coverUrl = $derived(assetUrl(project.cover_path));
let coverFailed = $state(false);
const STATUS_CLASS: Record<string, string> = {
draft: 'st-draft',
in_progress: 'st-progress',
completed: 'st-done',
};
const STATUS_KEY: Record<string, string> = {
draft: 'home.statusDraft',
in_progress: 'home.statusProgress',
completed: 'home.statusDone',
};
const statusClass = $derived(STATUS_CLASS[project.status] ?? 'st-draft');
const statusLabel = $derived(
project.status in STATUS_KEY ? t(STATUS_KEY[project.status]) : project.status,
);
function relativeTime(iso: string): string {
const then = new Date(iso).getTime();
if (Number.isNaN(then)) return '';
const mins = Math.max(0, Math.round((Date.now() - then) / 60000));
if (mins < 1) return t('projectCard.timeJustNow');
if (mins < 60) return t('projectCard.timeM', { count: mins });
const hours = Math.round(mins / 60);
if (hours < 24) return t('projectCard.timeH', { count: hours });
const days = Math.round(hours / 24);
if (days < 30) return t('projectCard.timeD', { count: days });
const months = Math.round(days / 30);
if (months < 12) return t('projectCard.timeMo', { count: months });
return t('projectCard.timeY', { count: Math.round(months / 12) });
}
const updatedLabel = $derived(relativeTime(project.updated_at));
// ---- overflow menu (rename / delete), pattern from ProjectCard ----
let menuOpen = $state(false);
let menuEl = $state<HTMLDivElement | null>(null);
$effect(() => {
if (!menuOpen) return;
const onDocClick = (e: MouseEvent) => {
if (menuEl && !menuEl.contains(e.target as Node)) menuOpen = false;
};
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') menuOpen = false;
};
window.addEventListener('click', onDocClick);
window.addEventListener('keydown', onKey);
return () => {
window.removeEventListener('click', onDocClick);
window.removeEventListener('keydown', onKey);
};
});
let renameOpen = $state(false);
let renameValue = $state('');
function openRename() {
menuOpen = false;
renameValue = project.title;
renameOpen = true;
}
const renameMutation = createMutation({
mutationFn: (title: string) => projects.update(project.id, { title }),
onSuccess: () => {
client.invalidateQueries({ queryKey: ['projects'] });
toast.success(t('projectCard.renamedTo', { title: renameValue }));
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : t('projectCard.renameFailed'));
},
});
function submitRename() {
const title = renameValue.trim();
renameOpen = false;
if (!title || title === project.title) return;
$renameMutation.mutate(title);
}
let deleteOpen = $state(false);
const deleteMutation = createMutation({
mutationFn: () => projects.delete(project.id),
onSuccess: () => {
client.invalidateQueries({ queryKey: ['projects'] });
toast.success(t('projectCard.deleted', { title: project.title }));
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : t('projectCard.deleteFailed'));
},
});
</script>
<article class="a-card">
<button
type="button"
class="card-main"
aria-label={t('projectCard.open', { title: project.title })}
onclick={() => goto(`/project/${project.id}`)}
>
<span class="cover">
{#if coverUrl && !coverFailed}
<img
class="cover-img"
src={coverUrl}
alt=""
loading="lazy"
onerror={() => (coverFailed = true)}
/>
{:else}
<span class="cover-ph" style:background={placeholder} aria-hidden="true">
<Icon name="film" size={22} />
</span>
{/if}
<span class="status-tag {statusClass}">{statusLabel}</span>
</span>
<span class="body">
<span class="title-row">
<span class="title">{project.title}</span>
<span class="arrow" aria-hidden="true">→</span>
</span>
<span class="idea">{project.idea || t('home.noIdea')}</span>
<span class="meta">
<span class="meta-stats mono">
{t('home.statScenes', { n: stats.scene_count })}
· {t('home.statCharacters', { n: stats.character_count })}
· {t('home.statAssets', {
ready: stats.asset_ready_count,
total: stats.asset_total_count,
})}
</span>
<span class="meta-time">{updatedLabel}</span>
</span>
</span>
</button>
<div class="menu-wrap" bind:this={menuEl}>
<button
type="button"
class="menu-btn"
aria-label={t('projectCard.actions', { title: project.title })}
aria-haspopup="menu"
aria-expanded={menuOpen}
onclick={() => (menuOpen = !menuOpen)}
>
⋯
</button>
{#if menuOpen}
<div class="menu" role="menu">
<button type="button" role="menuitem" class="menu-item" onclick={openRename}>
<Icon name="edit" size={14} />
{t('common.rename')}
</button>
<button
type="button"
role="menuitem"
class="menu-item danger"
onclick={() => {
menuOpen = false;
deleteOpen = true;
}}
>
<Icon name="trash" size={14} />
{t('common.delete')}
</button>
</div>
{/if}
</div>
</article>
<Modal bind:open={renameOpen} title={t('projectCard.renameTitle')}>
<form
onsubmit={(e) => {
e.preventDefault();
submitRename();
}}
>
<label class="field">
<span class="field-label">{t('common.title')}</span>
<input class="field-input" bind:value={renameValue} required />
</label>
</form>
{#snippet footer()}
<Button variant="ghost" onclick={() => (renameOpen = false)}>{t('common.cancel')}</Button>
<Button
variant="primary"
disabled={!renameValue.trim() || $renameMutation.isPending}
onclick={submitRename}
>
{t('common.rename')}
</Button>
{/snippet}
</Modal>
<ConfirmDialog
bind:open={deleteOpen}
title={t('projectCard.deleteTitle')}
message={t('projectCard.deleteMessage', { title: project.title })}
confirmLabel={t('common.delete')}
danger
onconfirm={() => $deleteMutation.mutate()}
/>
<style>
.a-card {
position: relative;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
overflow: hidden;
transition: border-color 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
.a-card:hover {
border-color: var(--border-strong);
}
.a-card:hover .arrow {
opacity: 1;
transform: translateX(0);
}
.card-main {
display: flex;
flex-direction: column;
width: 100%;
padding: 0;
border: none;
background: transparent;
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
}
.card-main:focus-visible {
outline: 2px solid var(--accent);
outline-offset: -2px;
}
.cover {
position: relative;
display: block;
height: 132px;
background: var(--surface-2);
overflow: hidden;
}
.cover-img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.cover-ph {
position: absolute;
inset: 0;
display: inline-flex;
align-items: center;
justify-content: center;
color: rgba(22, 19, 10, 0.82);
opacity: 0.9;
}
.status-tag {
position: absolute;
top: 8px;
right: 8px;
padding: 2px 9px;
border-radius: 999px;
font-size: 10.5px;
font-weight: 600;
backdrop-filter: blur(4px);
}
.st-draft {
color: var(--text-2);
background: rgba(27, 30, 37, 0.85);
border: 1px solid var(--border-strong);
}
.st-progress {
color: var(--accent);
background: var(--accent-dim);
}
.st-done {
color: var(--success);
background: var(--success-dim);
}
.body {
display: flex;
flex-direction: column;
gap: 6px;
padding: 14px 16px 15px;
}
.title-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.title {
font-size: 14px;
font-weight: 600;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.arrow {
color: var(--accent);
font-size: 13px;
opacity: 0;
transform: translateX(-6px);
transition:
opacity 150ms cubic-bezier(0.16, 1, 0.3, 1),
transform 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
.idea {
font-size: 12px;
color: var(--text-2);
line-height: 1.6;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
min-height: 2.2em;
}
.meta {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
}
.meta-stats {
font-size: 11px;
color: var(--text-3);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.meta-time {
font-size: 11px;
color: var(--text-3);
flex-shrink: 0;
}
.menu-wrap {
position: absolute;
top: 8px;
left: 8px;
z-index: 3;
}
.menu-btn {
width: 28px;
height: 28px;
border: 1px solid transparent;
border-radius: 7px;
background: rgba(13, 14, 17, 0.6);
color: var(--text-2);
font-size: 15px;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 150ms;
}
.a-card:hover .menu-btn,
.menu-btn:focus-visible,
.menu-btn[aria-expanded='true'] {
opacity: 1;
}
.menu-btn:hover {
background: var(--surface-3);
color: var(--text);
}
.menu {
position: absolute;
top: 32px;
left: 0;
min-width: 132px;
background: var(--surface-2);
border: 1px solid var(--border-strong);
border-radius: 8px;
padding: 4px;
display: flex;
flex-direction: column;
}
.menu-item {
display: flex;
align-items: center;
gap: 8px;
width: 100%;
padding: 7px 9px;
border: none;
border-radius: 6px;
background: transparent;
color: var(--text);
font-size: 12.5px;
font-family: inherit;
cursor: pointer;
text-align: left;
}
.menu-item:hover {
background: var(--surface-3);
}
.menu-item.danger {
color: var(--error);
}
.menu-item.danger:hover {
background: var(--error-dim);
}
/* restyle reused ui/Button + form primitives inside the darkroom scope */
.a-card :global(.btn-primary) {
background: var(--accent);
color: var(--accent-contrast);
}
.a-card :global(.field-input) {
background: var(--surface-2);
border-color: var(--border-strong);
color: var(--text);
}
</style>
@@ -0,0 +1,458 @@
<script lang="ts">
import { createQuery } from '@tanstack/svelte-query';
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 { t } from '$lib/i18n.svelte';
/**
* A「片场暗房」application shell — spec-v2 §3 (HEL-608).
*
* 216px left navigation with the confirmed item order, the 影工坊 brand,
* a ComfyUI address row pinned to the nav bottom, and a per-page top bar
* (title 20/600 + gray blurb + page actions). Unbuilt pages stay in the
* nav with an honest 「开发中」 pill instead of pretending to work.
*/
type NavId =
| 'projects'
| 'workbench'
| 'image'
| 'video'
| 'tasks'
| 'agents'
| 'connections'
| 'models'
| 'settings';
interface NavItem {
id: NavId;
labelKey: string;
icon: IconName;
href?: string;
wip?: boolean;
}
// Order is fixed by spec-v2 §3: 项目 / 创作工作台 / 生图 / 生视频 /
// 生成任务 / 智能体 / ComfyUI 连接 / 模型设置 / 设置.
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: 'agents', labelKey: 'shell.navAgents', icon: 'sparkle', href: '/agents' },
{ id: 'connections', labelKey: 'shell.navConnections', icon: 'link', wip: true },
{ id: 'models', labelKey: 'shell.navModels', icon: 'assets', href: '/models' },
{ id: 'settings', labelKey: 'shell.navSettings', icon: 'settings', href: '/settings' },
];
interface Props {
active: NavId;
title: string;
subtitle?: string;
/** Page-level actions rendered right of the top bar (chips / buttons). */
actions?: import('svelte').Snippet;
children?: import('svelte').Snippet;
}
let { active, title, subtitle, actions, children }: Props = $props();
// Real ComfyUI address from settings — shown honestly without a fake
// "connected" claim; the standalone connections page is not built yet.
const settingsQuery = createQuery({
queryKey: ['settings'],
queryFn: settings.get,
staleTime: 60_000,
});
const comfyUrl = $derived.by(() => {
const raw = ($settingsQuery.data?.comfyui_base_url ?? '').trim();
if (!raw) return '';
try {
const u = new URL(raw.includes('://') ? raw : `http://${raw}`);
return u.host;
} catch {
return raw;
}
});
</script>
<svelte:head>
<title>{title} · {t('shell.brand')}</title>
</svelte:head>
<div class="a-shell a-darkroom">
<!-- Mobile guard: this is a desktop-first tool (spec §4.5). -->
<div class="desktop-only-notice" data-testid="mobile-notice">
<Icon name="film" size={22} />
<p>{t('shell.mobileNotice')}</p>
</div>
<div class="shell-frame">
<aside class="side">
<a class="brand" href="/" title={t('shell.brandHome')}>
<span class="brand-mark"><Icon name="film" size={17} /></span>
<span class="brand-name">{t('shell.brand')}</span>
</a>
<nav class="nav" aria-label={t('shell.navAria')}>
{#each NAV as item (item.id)}
{#if item.href}
<a
class="nav-item"
class:active={active === item.id}
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>
{:else}
<span class="nav-item disabled" title={t('shell.wipHint')} aria-disabled="true">
<span class="nav-icon"><Icon name={item.icon} size={17} /></span>
<span class="nav-label">{t(item.labelKey)}</span>
<span class="wip-pill">{t('shell.wip')}</span>
</span>
{/if}
{/each}
</nav>
<div class="side-foot">
<a class="comfy-row" href="/settings" title={t('shell.comfyManage')}>
<span class="dot" aria-hidden="true"></span>
<span class="comfy-text">
{#if comfyUrl}
{t('shell.comfyAt', { host: comfyUrl })}
{:else}
{t('shell.comfyUnset')}
{/if}
</span>
</a>
<div class="lang-row">
<LanguageSwitcher />
</div>
</div>
</aside>
<div class="main">
<header class="topbar">
<div class="topbar-copy">
<h1>{title}</h1>
{#if subtitle}<p class="sub">{subtitle}</p>{/if}
</div>
{#if actions}
<div class="topbar-actions">
{@render actions()}
</div>
{/if}
</header>
<div class="body">
{@render children?.()}
</div>
</div>
</div>
</div>
<style>
.a-shell {
position: fixed;
inset: 0;
}
.desktop-only-notice {
display: none;
}
.shell-frame {
height: 100%;
display: flex;
min-width: 0;
}
/* ---------------- side navigation (§3, 216px) ---------------- */
.side {
width: 216px;
flex-shrink: 0;
background: var(--surface);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
padding: 16px 12px 12px;
gap: 14px;
box-sizing: border-box;
overflow-y: auto;
}
.brand {
display: flex;
align-items: center;
gap: 9px;
padding: 2px 8px;
text-decoration: none;
color: var(--text);
}
.brand-mark {
width: 30px;
height: 30px;
border-radius: 8px;
background: linear-gradient(135deg, #e8a33d, #b96a1b);
color: #16130a;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.brand-name {
font-size: 15.5px;
font-weight: 700;
letter-spacing: 0.02em;
white-space: nowrap;
}
.nav {
display: flex;
flex-direction: column;
gap: 2px;
}
.nav-item {
display: flex;
align-items: center;
gap: 10px;
min-height: 38px;
padding: 0 10px;
border-radius: 8px;
color: var(--text-2);
font-size: 13px;
text-decoration: none;
transition:
background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
color 150ms;
}
.nav-item .nav-icon {
display: inline-flex;
flex-shrink: 0;
}
a.nav-item:hover {
background: var(--surface-3);
color: var(--text);
}
.nav-item.active {
background: var(--surface-3);
color: var(--text);
font-weight: 600;
}
.nav-item.disabled {
cursor: default;
user-select: none;
color: var(--text-3);
}
.wip-pill {
margin-left: auto;
padding: 1px 8px;
border-radius: 999px;
background: var(--surface-3);
color: var(--text-3);
font-size: 10px;
white-space: nowrap;
}
.side-foot {
margin-top: auto;
display: flex;
flex-direction: column;
gap: 8px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.comfy-row {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border-radius: 7px;
text-decoration: none;
color: var(--text-2);
font-size: 11.5px;
transition:
background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
color 150ms;
}
.comfy-row:hover {
background: var(--surface-3);
color: var(--text);
}
/* Untested by default — the connections page (a6) is not built yet, so
no green "connected" claim is made (honesty rule on HEL-608). */
.dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--text-3);
flex-shrink: 0;
}
.comfy-text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.lang-row :global(.lang-switcher) {
background: var(--surface-2);
color: var(--text-2);
border-color: var(--border-strong);
width: 100%;
box-sizing: border-box;
}
/* ---------------- main column ---------------- */
.main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
background: var(--bg);
}
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 14px 28px;
border-bottom: 1px solid var(--border);
background: var(--bg);
flex-shrink: 0;
min-height: 64px;
box-sizing: border-box;
}
.topbar-copy h1 {
margin: 0;
font-size: 20px;
font-weight: 600;
color: var(--text);
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sub {
margin: 3px 0 0;
font-size: 12.5px;
color: var(--text-3);
line-height: 1.5;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.topbar-actions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.body {
flex: 1;
min-height: 0;
overflow-y: auto;
}
/* ---------------- responsive (§4.5) ---------------- */
@media (max-width: 1023px) {
.side {
width: 64px;
padding: 14px 8px 10px;
align-items: center;
}
.brand {
padding: 0;
justify-content: center;
}
.brand-name {
display: none;
}
.nav {
width: 100%;
}
.nav-item {
justify-content: center;
padding: 0;
}
.nav-label {
display: none;
}
.wip-pill {
display: none;
}
/* icon-only rail: a small dot marks unbuilt entries */
.nav-item.disabled .nav-icon {
position: relative;
}
.nav-item.disabled .nav-icon::after {
content: '';
position: absolute;
top: -2px;
right: -4px;
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--text-3);
}
.comfy-text,
.lang-row {
display: none;
}
.comfy-row {
justify-content: center;
padding: 6px;
}
.topbar {
padding: 12px 18px;
}
.sub {
white-space: normal;
}
}
@media (max-width: 767px) {
.shell-frame {
display: none;
}
.desktop-only-notice {
display: flex;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
padding: 32px;
text-align: center;
color: var(--text-2);
}
.desktop-only-notice p {
margin: 0;
font-size: 14px;
line-height: 1.7;
}
.desktop-only-notice :global(.icon) {
color: var(--accent);
}
}
</style>
+60
View File
@@ -1222,4 +1222,64 @@ export const de: Dict = {
'models.loading': 'Lädt…',
'models.loadFailed': 'Einstellungen konnten nicht geladen werden',
'models.idleFormHint': '„Bearbeiten“ auf einer Karte wählen oder oben „Modell hinzufügen“ klicken',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': 'Film-Atelier',
'shell.brandHome': 'Zur Projektübersicht',
'shell.navAria': 'Hauptnavigation',
'shell.navProjects': 'Projekte',
'shell.navWorkbench': 'Werkstatt',
'shell.navImage': 'Bilderzeugen',
'shell.navVideo': 'Videoerzeugen',
'shell.navTasks': 'Aufträge',
'shell.navAgents': 'Agenten',
'shell.navConnections': 'ComfyUI-Verbindungen',
'shell.navModels': 'Modelle',
'shell.navSettings': 'Einstellungen',
'shell.wip': 'In Entwicklung',
'shell.wipHint': 'Diese Seite ist noch im Bau und folgt später',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · nicht konfiguriert',
'shell.comfyManage': 'ComfyUI-Adresse in den Einstellungen pflegen',
'shell.mobileNotice': 'Bitte öffne diese Werkbank in einem Desktop-Browser (mindestens 768px breit); Handys werden noch nicht unterstützt.',
'home.title': 'Projektübersicht',
'home.subtitle': 'Verwalte deine Projekte — starte mit einer Idee oder einem fertigen Drehbuch.',
'home.projectCount': '{n} Projekte · {m} in Arbeit',
'home.startIdea': 'Mit einer Idee starten',
'home.importScript': 'Drehbuch importieren',
'home.entryIdeaTitle': 'Mit einer Idee starten',
'home.entryIdeaBody': 'Beschreibe eine Idee; die Agenten führen sie Schritt für Schritt durch Story, Storyboard und Clips.',
'home.entryScriptTitle': 'Drehbuch importieren',
'home.entryScriptBody': 'Schon ein Drehbuch? Einfügen, Projekt anlegen und der Drehbuch-Agent zerlegt es in geordnete Szenen.',
'home.ideaPlaceholder': 'Ein regnerischer kleiner Hafen, in dem der Leuchtfeuerwärter …',
'home.scriptField': 'Vollständiges Drehbuch',
'home.scriptPlaceholder': 'Das vollständige Drehbuch hier einfügen …',
'home.scriptHint': 'Nach dem Anlegen öffnet sich die Agenten-Seite; der Drehbuch-Agent macht aus dem Text geordnete Szenen.',
'home.errTitle': 'Bitte gib dem Projekt einen Titel',
'home.errScript': 'Bitte füge das vollständige Drehbuch ein',
'home.myProjects': 'Meine Projekte',
'home.myProjectsHint': 'Projekt anklicken, um weiterzuarbeiten',
'home.emptyProjects': 'Noch keine Projekte. Lege oben über „Mit einer Idee starten“ oder „Drehbuch importieren“ das erste an.',
'home.noIdea': 'Noch keine Ideenbeschreibung',
'home.statScenes': '{n} Szenen',
'home.statCharacters': '{n} Figuren',
'home.statAssets': 'Assets {ready}/{total}',
'home.statusDraft': 'Entwurf',
'home.statusProgress': 'In Arbeit',
'home.statusDone': 'Abgeschlossen',
'home.tasksTitle': 'Aufträge',
'home.activeJobs': '{n} aktiv',
'home.emptyJobs': 'Noch keine Generierungsaufträge',
'home.emptyJobsSub': 'Aufträge aus Projekten oder der Werkstatt erscheinen hier.',
'home.tasksNote': 'Die eigenständige Auftragsseite ist in Entwicklung; die vollständige Historie liegt derzeit in jedem Projekt.',
'home.kindImage': 'Bild',
'home.kindVideo': 'Video',
'home.kindExport': 'Film',
'home.jobDone': 'fertig',
'home.jobRunning': 'läuft',
'home.jobQueued': 'wartet',
'home.jobFailed': 'fehlgeschlagen',
'home.jobRequeued': 'Auftrag erneut eingereiht',
'home.jobRetryFailed': 'Erneutes Einreihen fehlgeschlagen',
'home.jobProject': 'Projekt #{id}',
};
+60
View File
@@ -1222,5 +1222,65 @@ export const en = {
'models.loading': 'Loading…',
'models.loadFailed': 'Failed to load settings',
'models.idleFormHint': 'Pick "Edit" on a card, or click "Add model" above',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': 'Film Atelier',
'shell.brandHome': 'Back to project overview',
'shell.navAria': 'Primary',
'shell.navProjects': 'Projects',
'shell.navWorkbench': 'Workbench',
'shell.navImage': 'Image Gen',
'shell.navVideo': 'Video Gen',
'shell.navTasks': 'Jobs',
'shell.navAgents': 'Agents',
'shell.navConnections': 'ComfyUI Connections',
'shell.navModels': 'Models',
'shell.navSettings': 'Settings',
'shell.wip': 'In development',
'shell.wipHint': 'This page is under construction and will open later',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · not configured',
'shell.comfyManage': 'Configure the ComfyUI address in Settings',
'shell.mobileNotice': 'Please open this workbench in a desktop browser (at least 768px wide). Phones are not supported yet.',
'home.title': 'Projects overview',
'home.subtitle': 'Manage your projects — start from an idea or a ready-made script.',
'home.projectCount': '{n} projects · {m} in progress',
'home.startIdea': 'Start from an idea',
'home.importScript': 'Import a script',
'home.entryIdeaTitle': 'Start from an idea',
'home.entryIdeaBody': 'Describe an idea once; the agents take it through story, boards and clips step by step.',
'home.entryScriptTitle': 'Import a script',
'home.entryScriptBody': 'Already have a script? Paste it in, create the project, and let the script agent break it into ordered scenes.',
'home.ideaPlaceholder': 'A rainy little harbor where the lighthouse keeper finds…',
'home.scriptField': 'Full script',
'home.scriptPlaceholder': 'Paste the complete script here…',
'home.scriptHint': 'After creating, the Agents page opens and the script agent turns the pasted script into ordered scenes.',
'home.errTitle': 'Please give the project a title',
'home.errScript': 'Please paste the full script',
'home.myProjects': 'My projects',
'home.myProjectsHint': 'Click a project to continue working',
'home.emptyProjects': 'No projects yet. Use “Start from an idea” or “Import a script” above to create the first one.',
'home.noIdea': 'No idea description yet',
'home.statScenes': '{n} scenes',
'home.statCharacters': '{n} characters',
'home.statAssets': 'assets {ready}/{total}',
'home.statusDraft': 'Draft',
'home.statusProgress': 'In progress',
'home.statusDone': 'Completed',
'home.tasksTitle': 'Jobs',
'home.activeJobs': '{n} active',
'home.emptyJobs': 'No generation jobs yet',
'home.emptyJobsSub': 'Jobs started from a project or the workbench will show up here.',
'home.tasksNote': 'The standalone Jobs page is under development; for now full job history lives inside each project.',
'home.kindImage': 'image',
'home.kindVideo': 'video',
'home.kindExport': 'film',
'home.jobDone': 'done',
'home.jobRunning': 'running',
'home.jobQueued': 'queued',
'home.jobFailed': 'failed',
'home.jobRequeued': 'Job requeued',
'home.jobRetryFailed': 'Could not requeue the job',
'home.jobProject': 'Project #{id}',
};
export type Dict = typeof en;
+60
View File
@@ -1222,4 +1222,64 @@ export const es: Dict = {
'models.loading': 'Cargando…',
'models.loadFailed': 'No se pudieron cargar los ajustes',
'models.idleFormHint': 'Pulsa «Editar» en una tarjeta o «Añadir modelo» arriba',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': 'Atelier de Cine',
'shell.brandHome': 'Volver al resumen de proyectos',
'shell.navAria': 'Navegación principal',
'shell.navProjects': 'Proyectos',
'shell.navWorkbench': 'Taller',
'shell.navImage': 'Generar imagen',
'shell.navVideo': 'Generar vídeo',
'shell.navTasks': 'Tareas',
'shell.navAgents': 'Agentes',
'shell.navConnections': 'Conexiones ComfyUI',
'shell.navModels': 'Modelos',
'shell.navSettings': 'Ajustes',
'shell.wip': 'En desarrollo',
'shell.wipHint': 'Esta página está en construcción y llegará más adelante',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · sin configurar',
'shell.comfyManage': 'Configura la dirección de ComfyUI en Ajustes',
'shell.mobileNotice': 'Abre este banco de trabajo en un navegador de escritorio (mínimo 768 px); los móviles aún no se admiten.',
'home.title': 'Resumen de proyectos',
'home.subtitle': 'Gestiona tus proyectos: empieza con una idea o un guion terminado.',
'home.projectCount': '{n} proyectos · {m} en curso',
'home.startIdea': 'Empezar con una idea',
'home.importScript': 'Importar guion',
'home.entryIdeaTitle': 'Empezar con una idea',
'home.entryIdeaBody': 'Describe una idea; los agentes la llevan por historia, storyboard y clips paso a paso.',
'home.entryScriptTitle': 'Importar guion',
'home.entryScriptBody': '¿Ya tienes guion? Pégalo, crea el proyecto y el agente de guion lo dividirá en escenas ordenadas.',
'home.ideaPlaceholder': 'Un pequeño puerto lluvioso donde el farero descubre…',
'home.scriptField': 'Guion completo',
'home.scriptPlaceholder': 'Pega aquí el guion completo…',
'home.scriptHint': 'Al crearlo se abre la página de Agentes; el agente de guion convierte el texto en escenas ordenadas.',
'home.errTitle': 'Ponle un título al proyecto',
'home.errScript': 'Pega el guion completo',
'home.myProjects': 'Mis proyectos',
'home.myProjectsHint': 'Haz clic en un proyecto para continuar',
'home.emptyProjects': 'Aún no hay proyectos. Crea el primero con «Empezar con una idea» o «Importar guion».',
'home.noIdea': 'Sin descripción de la idea',
'home.statScenes': '{n} escenas',
'home.statCharacters': '{n} personajes',
'home.statAssets': 'recursos {ready}/{total}',
'home.statusDraft': 'Borrador',
'home.statusProgress': 'En curso',
'home.statusDone': 'Terminado',
'home.tasksTitle': 'Tareas',
'home.activeJobs': '{n} activas',
'home.emptyJobs': 'Aún no hay tareas de generación',
'home.emptyJobsSub': 'Las tareas iniciadas en un proyecto o en el taller aparecerán aquí.',
'home.tasksNote': 'La página independiente de tareas está en desarrollo; el historial completo vive por ahora en cada proyecto.',
'home.kindImage': 'imagen',
'home.kindVideo': 'vídeo',
'home.kindExport': 'película',
'home.jobDone': 'lista',
'home.jobRunning': 'en curso',
'home.jobQueued': 'en cola',
'home.jobFailed': 'fallida',
'home.jobRequeued': 'Tarea reencolada',
'home.jobRetryFailed': 'No se pudo reencolar la tarea',
'home.jobProject': 'Proyecto #{id}',
};
+60
View File
@@ -1222,4 +1222,64 @@ export const fr: Dict = {
'models.loading': 'Chargement…',
'models.loadFailed': 'Impossible de charger les paramètres',
'models.idleFormHint': 'Cliquez « Modifier » sur une carte ou « Ajouter un modèle » ci-dessus',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': 'Atelier Cinéma',
'shell.brandHome': 'Retour à l\'aperçu des projets',
'shell.navAria': 'Navigation principale',
'shell.navProjects': 'Projets',
'shell.navWorkbench': 'Atelier',
'shell.navImage': 'Génération d\'image',
'shell.navVideo': 'Génération vidéo',
'shell.navTasks': 'Tâches',
'shell.navAgents': 'Agents',
'shell.navConnections': 'Connexions ComfyUI',
'shell.navModels': 'Modèles',
'shell.navSettings': 'Réglages',
'shell.wip': 'En développement',
'shell.wipHint': 'Cette page est en construction et arrivera plus tard',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · non configuré',
'shell.comfyManage': 'Configurez l\'adresse ComfyUI dans les Réglages',
'shell.mobileNotice': 'Ouvrez cet atelier dans un navigateur de bureau (largeur minimum 768 px) ; les téléphones ne sont pas encore pris en charge.',
'home.title': 'Aperçu des projets',
'home.subtitle': 'Gérez vos projets — commencez avec une idée ou un scénario prêt.',
'home.projectCount': '{n} projets · {m} en cours',
'home.startIdea': 'Commencer avec une idée',
'home.importScript': 'Importer un scénario',
'home.entryIdeaTitle': 'Commencer avec une idée',
'home.entryIdeaBody': 'Décrivez une idée ; les agents la mènent étape par étape à travers l\'histoire, le storyboard et les plans.',
'home.entryScriptTitle': 'Importer un scénario',
'home.entryScriptBody': 'Vous avez déjà un scénario ? Collez-le, créez le projet et l\'agent scénario le découpe en scènes ordonnées.',
'home.ideaPlaceholder': 'Un petit port pluvieux où le gardien de phare découvre…',
'home.scriptField': 'Scénario complet',
'home.scriptPlaceholder': 'Collez ici le scénario complet…',
'home.scriptHint': 'Après création, la page Agents s\'ouvre et l\'agent scénario transforme le texte en scènes ordonnées.',
'home.errTitle': 'Donnez un titre au projet',
'home.errScript': 'Collez le scénario complet',
'home.myProjects': 'Mes projets',
'home.myProjectsHint': 'Cliquez sur un projet pour continuer',
'home.emptyProjects': 'Aucun projet pour le moment. Créez le premier avec « Commencer avec une idée » ou « Importer un scénario ».',
'home.noIdea': 'Pas encore de description',
'home.statScenes': '{n} scènes',
'home.statCharacters': '{n} personnages',
'home.statAssets': 'ressources {ready}/{total}',
'home.statusDraft': 'Brouillon',
'home.statusProgress': 'En cours',
'home.statusDone': 'Terminé',
'home.tasksTitle': 'Tâches',
'home.activeJobs': '{n} actives',
'home.emptyJobs': 'Aucune tâche de génération',
'home.emptyJobsSub': 'Les tâches lancées depuis un projet ou l\'atelier s\'afficheront ici.',
'home.tasksNote': 'La page Tâches autonome est en développement ; l\'historique complet reste pour l\'instant dans chaque projet.',
'home.kindImage': 'image',
'home.kindVideo': 'vidéo',
'home.kindExport': 'film',
'home.jobDone': 'terminée',
'home.jobRunning': 'en cours',
'home.jobQueued': 'en attente',
'home.jobFailed': 'échouée',
'home.jobRequeued': 'Tâche remise en file',
'home.jobRetryFailed': 'Impossible de remettre la tâche en file',
'home.jobProject': 'Projet #{id}',
};
+60
View File
@@ -1222,4 +1222,64 @@ export const ja: Dict = {
'models.loading': '読み込み中…',
'models.loadFailed': '設定の読み込みに失敗しました',
'models.idleFormHint': 'カードの「編集」を選ぶか、上の「モデルを追加」をクリックしてください',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': '映画工房',
'shell.brandHome': 'プロジェクト概要へ戻る',
'shell.navAria': 'メインナビゲーション',
'shell.navProjects': 'プロジェクト',
'shell.navWorkbench': '制作ワークベンチ',
'shell.navImage': '画像生成',
'shell.navVideo': '動画生成',
'shell.navTasks': '生成タスク',
'shell.navAgents': 'エージェント',
'shell.navConnections': 'ComfyUI 接続',
'shell.navModels': 'モデル設定',
'shell.navSettings': '設定',
'shell.wip': '開発中',
'shell.wipHint': 'このページは準備中です。後ほど公開されます',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · 未設定',
'shell.comfyManage': '「設定」で ComfyUI のアドレスを設定できます',
'shell.mobileNotice': 'このワークベンチはデスクトップブラウザ(幅 768px 以上)で開いてください。スマートフォンには未対応です。',
'home.title': 'プロジェクト概要',
'home.subtitle': '創作プロジェクトを管理 — アイデアでも完成台本でも始められます。',
'home.projectCount': 'プロジェクト {n} 件 · 進行中 {m} 件',
'home.startIdea': 'アイデアから始める',
'home.importScript': '台本を取り込む',
'home.entryIdeaTitle': 'アイデアから始める',
'home.entryIdeaBody': 'アイデアを書くと、エージェントが物語・絵コンテ・クリップへ順を追って仕上げます。',
'home.entryScriptTitle': '台本を取り込む',
'home.entryScriptBody': '完成した台本があれば貼り付けてプロジェクトを作成。台本エージェントが順序立ったシーンに整理します。',
'home.ideaPlaceholder': '雨の夜の小さな港で、灯台守が見つけたものは……',
'home.scriptField': '台本全文',
'home.scriptPlaceholder': '台本の全文をここに貼り付けてください……',
'home.scriptHint': '作成後「エージェント」ページが開き、台本エージェントが順序立ったシーンに整理します。',
'home.errTitle': 'プロジェクトにタイトルを付けてください',
'home.errScript': '台本の全文を貼り付けてください',
'home.myProjects': 'マイプロジェクト',
'home.myProjectsHint': 'プロジェクトをクリックして作業を続ける',
'home.emptyProjects': 'まだプロジェクトがありません。上の「アイデアから始める」か「台本を取り込む」で最初のプロジェクトを作成しましょう。',
'home.noIdea': 'アイデアの説明はまだありません',
'home.statScenes': 'シーン {n}',
'home.statCharacters': '登場人物 {n}',
'home.statAssets': '素材 {ready}/{total}',
'home.statusDraft': '下書き',
'home.statusProgress': '進行中',
'home.statusDone': '完了',
'home.tasksTitle': '生成タスク',
'home.activeJobs': '{n} 件実行中',
'home.emptyJobs': '生成タスクはまだありません',
'home.emptyJobsSub': 'プロジェクトやワークベンチから生成を開始すると、ここに表示されます。',
'home.tasksNote': '独立した「生成タスク」ページは開発中。現在は各プロジェクト内で完全な履歴を確認できます。',
'home.kindImage': '画像',
'home.kindVideo': '動画',
'home.kindExport': '映画',
'home.jobDone': '完了',
'home.jobRunning': '実行中',
'home.jobQueued': '待機中',
'home.jobFailed': '失敗',
'home.jobRequeued': 'タスクを再び待機列に入れました',
'home.jobRetryFailed': 'タスクを再待機できませんでした',
'home.jobProject': 'プロジェクト #{id}',
};
+60
View File
@@ -1222,4 +1222,64 @@ export const ko: Dict = {
'models.loading': '불러오는 중…',
'models.loadFailed': '설정을 불러오지 못했습니다',
'models.idleFormHint': '카드의 «편집»을 누르거나 위의 «모델 추가»를 클릭하세요',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': '영화 공작소',
'shell.brandHome': '프로젝트 개요로 돌아가기',
'shell.navAria': '주요 탐색',
'shell.navProjects': '프로젝트',
'shell.navWorkbench': '창작 워크벤치',
'shell.navImage': '이미지 생성',
'shell.navVideo': '영상 생성',
'shell.navTasks': '생성 작업',
'shell.navAgents': '에이전트',
'shell.navConnections': 'ComfyUI 연결',
'shell.navModels': '모델 설정',
'shell.navSettings': '설정',
'shell.wip': '개발 중',
'shell.wipHint': '이 페이지는 준비 중이며 곧 열립니다',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · 미설정',
'shell.comfyManage': '「설정」에서 ComfyUI 주소를 설정하세요',
'shell.mobileNotice': '이 워크벤치는 데스크톱 브라우저(폭 768px 이상)에서 열어 주세요. 휴대폰은 아직 지원되지 않습니다.',
'home.title': '프로젝트 개요',
'home.subtitle': '창작 프로젝트를 관리하세요 — 아이디어나 완성된 대본으로 시작할 수 있습니다.',
'home.projectCount': '프로젝트 {n}개 · 진행 중 {m}개',
'home.startIdea': '아이디어로 시작',
'home.importScript': '대본 가져오기',
'home.entryIdeaTitle': '아이디어로 시작',
'home.entryIdeaBody': '아이디어를 적으면 에이전트가 이야기·스토리보드·클립을 단계별로 완성합니다.',
'home.entryScriptTitle': '대본 가져오기',
'home.entryScriptBody': '이미 대본이 있나요? 붙여넣어 프로젝트를 만들면 대본 에이전트가 순서 있는 장면으로 정리합니다.',
'home.ideaPlaceholder': '비 내리는 밤의 작은 항구, 등대지기가 발견한 것은……',
'home.scriptField': '대본 전문',
'home.scriptPlaceholder': '대본 전문을 여기에 붙여넣으세요……',
'home.scriptHint': '만들면 「에이전트」 페이지가 열리고 대본 에이전트가 순서 있는 장면으로 정리합니다.',
'home.errTitle': '프로젝트 제목을 입력하세요',
'home.errScript': '대본 전문을 붙여넣으세요',
'home.myProjects': '내 프로젝트',
'home.myProjectsHint': '프로젝트를 클릭해 이어서 작업',
'home.emptyProjects': '아직 프로젝트가 없습니다. 위의 「아이디어로 시작」 또는 「대본 가져오기」로 첫 프로젝트를 만들어 보세요.',
'home.noIdea': '아이디어 설명이 아직 없습니다',
'home.statScenes': '장면 {n}',
'home.statCharacters': '등장인물 {n}',
'home.statAssets': '소재 {ready}/{total}',
'home.statusDraft': '초안',
'home.statusProgress': '진행 중',
'home.statusDone': '완료',
'home.tasksTitle': '생성 작업',
'home.activeJobs': '{n}개 실행 중',
'home.emptyJobs': '아직 생성 작업이 없습니다',
'home.emptyJobsSub': '프로젝트나 워크벤치에서 생성을 시작하면 여기에 표시됩니다.',
'home.tasksNote': '독립적인 「생성 작업」 페이지는 개발 중입니다. 현재는 각 프로젝트에서 전체 기록을 볼 수 있습니다.',
'home.kindImage': '이미지',
'home.kindVideo': '영상',
'home.kindExport': '필름',
'home.jobDone': '완료',
'home.jobRunning': '실행 중',
'home.jobQueued': '대기 중',
'home.jobFailed': '실패',
'home.jobRequeued': '작업이 다시 대기열에 추가되었습니다',
'home.jobRetryFailed': '작업을 다시 대기열에 넣지 못했습니다',
'home.jobProject': '프로젝트 #{id}',
};
+60
View File
@@ -1222,4 +1222,64 @@ export const zh: Dict = {
'models.loading': '加载中…',
'models.loadFailed': '设置加载失败',
'models.idleFormHint': '从左侧选择「编辑」,或点上方「添加模型」新增配置',
// --- A shell + projects overview (HEL-608) ---
'shell.brand': '影工坊',
'shell.brandHome': '返回项目总览',
'shell.navAria': '主导航',
'shell.navProjects': '项目',
'shell.navWorkbench': '创作工作台',
'shell.navImage': '生图',
'shell.navVideo': '生视频',
'shell.navTasks': '生成任务',
'shell.navAgents': '智能体',
'shell.navConnections': 'ComfyUI 连接',
'shell.navModels': '模型设置',
'shell.navSettings': '设置',
'shell.wip': '开发中',
'shell.wipHint': '该页面正在开发中,稍后开放',
'shell.comfyAt': 'ComfyUI · {host}',
'shell.comfyUnset': 'ComfyUI · 未配置',
'shell.comfyManage': '在「设置」中配置 ComfyUI 地址',
'shell.mobileNotice': '请用桌面浏览器(宽 768px 以上)打开影工坊,手机端暂不适配。',
'home.title': '项目总览',
'home.subtitle': '管理创作项目,从一个创意或一份现成剧本开始。',
'home.projectCount': '{n} 个项目 · {m} 个进行中',
'home.startIdea': '从创意开始',
'home.importScript': '导入剧本',
'home.entryIdeaTitle': '从创意开始',
'home.entryIdeaBody': '填一个想法,交给智能体逐步完成故事、分镜与成片。',
'home.entryScriptTitle': '导入剧本',
'home.entryScriptBody': '已有现成剧本?粘贴进来创建项目,交给剧本智能体整理为有序场景。',
'home.ideaPlaceholder': '一个雨夜的小港,灯塔看守人发现了……',
'home.scriptField': '剧本全文',
'home.scriptPlaceholder': '把完整剧本粘贴到这里……',
'home.scriptHint': '创建后会打开「智能体」,由剧本智能体把剧本整理成有序场景。',
'home.errTitle': '请给项目起个标题',
'home.errScript': '请粘贴剧本全文',
'home.myProjects': '我的项目',
'home.myProjectsHint': '点击项目继续创作',
'home.emptyProjects': '还没有项目。从上方「从创意开始」或「导入剧本」创建第一个项目。',
'home.noIdea': '暂无创意描述',
'home.statScenes': '场景 {n}',
'home.statCharacters': '角色 {n}',
'home.statAssets': '素材 {ready}/{total}',
'home.statusDraft': '待开始',
'home.statusProgress': '进行中',
'home.statusDone': '已完成',
'home.tasksTitle': '生成任务',
'home.activeJobs': '{n} 进行中',
'home.emptyJobs': '还没有生成任务',
'home.emptyJobsSub': '进入项目或创作工作台发起生成后,任务会显示在这里。',
'home.tasksNote': '独立「生成任务」页开发中;当前可在各项目内查看完整任务。',
'home.kindImage': '图片',
'home.kindVideo': '视频',
'home.kindExport': '成片',
'home.jobDone': '完成',
'home.jobRunning': '进行中',
'home.jobQueued': '排队',
'home.jobFailed': '失败',
'home.jobRequeued': '任务已重新排队',
'home.jobRetryFailed': '重新排队失败',
'home.jobProject': '项目 #{id}',
};
+31
View File
@@ -0,0 +1,31 @@
/**
* ID generation that survives insecure contexts.
*
* `crypto.randomUUID()` is only exposed on secure contexts (HTTPS or
* localhost/127.0.0.1). On a LAN HTTP deployment (e.g.
* `http://192.168.200.15:8080`) the method is missing and direct calls crash
* with "crypto.randomUUID is not a function". `crypto.getRandomValues()` has
* no secure-context requirement, so the fallback builds a real RFC 4122 v4
* UUID from it; only when `crypto` is absent entirely do we degrade to a
* best-effort Math.random id.
*/
export function randomId(): string {
const c = globalThis.crypto;
if (c && typeof c.randomUUID === "function") return c.randomUUID();
if (c && typeof c.getRandomValues === "function")
return uuidV4(c.getRandomValues.bind(c));
return `id-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}${Math.random()
.toString(36)
.slice(2)}${Math.random().toString(36).slice(2)}`;
}
/** RFC 4122 version 4 UUID from a crypto-strength byte source. */
function uuidV4(getRandomValues: (array: Uint8Array) => Uint8Array): string {
const bytes = getRandomValues(new Uint8Array(16));
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join(
"",
);
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
}
@@ -21,6 +21,7 @@ import {
} from './helpers/posture';
import { sampleTrack } from './motion/sampleTrack';
import { normalizeShotParams, type ShotParams } from './calibration/shotSolver';
import { randomId } from '$lib/ids';
export type ComposerTool = 'select' | 'move' | 'rotate' | 'scale' | 'pose';
export type CharacterType = 'male' | 'female' | 'child';
@@ -117,9 +118,7 @@ export function isCharacterType(type: ObjectType): type is CharacterType {
}
function uid(): string {
return typeof crypto !== 'undefined' && 'randomUUID' in crypto
? crypto.randomUUID()
: `id-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
return randomId();
}
function findNearKeyframeIndex(keyframes: Keyframe[], time: number): number {
+975 -3
View File
@@ -1,5 +1,977 @@
<script lang="ts">
// The root route redirects to /agents in +page.ts. This empty component only
// exists to satisfy the leaf-route requirement; it is never rendered because
// load() throws redirect first. Kept as a defensive fallback.
// A「片场暗房」项目总览 — the confirmed a1 layout (HEL-608).
// Everything on this page is driven by real project / job records; when
// there is nothing yet, honest Chinese empty states are shown instead of
// the sample progress rendered in the mockup.
import { goto } from '$app/navigation';
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
import { jobsApi, projects, type Project } from '$lib/api';
import { agentDeepLink } from '$lib/agentTasks';
import AppShell from '$lib/components/shell/AppShell.svelte';
import AProjectCard from '$lib/components/home/AProjectCard.svelte';
import Button from '$lib/components/ui/Button.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import Skeleton from '$lib/components/ui/Skeleton.svelte';
import { toast } from '$lib/toast';
import { t } from '$lib/i18n.svelte';
const client = useQueryClient();
const projectsQuery = createQuery({
queryKey: ['projects'],
queryFn: projects.list,
});
const jobsQuery = createQuery({
queryKey: ['jobs', 'recent'],
queryFn: () => jobsApi.list(),
refetchInterval: 8000,
});
const allProjects = $derived($projectsQuery.data ?? []);
const inProgressCount = $derived(allProjects.filter((p) => p.status === 'in_progress').length);
// ------------------------------------------------------------------
// Entry flows — both lead to already-working Calliope flows:
// 从创意开始 → create project → project stage workspace (/project/:id)
// 导入剧本 → create project with the script stored → hand off to the
// project-linked script agent (/agents?project=…&task=script)
// ------------------------------------------------------------------
type EntryMode = 'none' | 'idea' | 'script';
let entryMode = $state<EntryMode>('none');
const GENRES = [
'Adventure / Mystery',
'Drama',
'Sci-Fi',
'Fantasy',
'Horror',
'Romance',
'Thriller',
];
const TONES = [
'Cinematic, atmospheric',
'Dark, tense',
'Whimsical, warm',
'Gritty, realistic',
'Epic, sweeping',
];
const DURATIONS = ['30 seconds', '1 minute', '2 minutes', '5 minutes', '10 minutes'];
let ideaForm = $state({
title: '',
idea: '',
genre: GENRES[0],
tone: TONES[0],
duration: DURATIONS[2],
});
let scriptForm = $state({ title: '', script: '' });
let showErrors = $state(false);
function openIdea() {
entryMode = 'idea';
showErrors = false;
ideaForm = {
title: '',
idea: '',
genre: GENRES[0],
tone: TONES[0],
duration: DURATIONS[2],
};
}
function openScript() {
entryMode = 'script';
showErrors = false;
scriptForm = { title: '', script: '' };
}
function closeEntry() {
entryMode = 'none';
showErrors = false;
}
const ideaErrors = $derived.by(() => {
const errs: Record<string, string> = {};
if (!ideaForm.title.trim()) errs.title = t('home.errTitle');
return errs;
});
const scriptErrors = $derived.by(() => {
const errs: Record<string, string> = {};
if (!scriptForm.title.trim()) errs.title = t('home.errTitle');
if (!scriptForm.script.trim()) errs.script = t('home.errScript');
return errs;
});
function onIdeaCreated(p: Project) {
client.invalidateQueries({ queryKey: ['projects'] });
toast.success(t('projects.created', { title: p.title }));
goto(`/project/${p.id}`);
}
function onScriptCreated(p: Project) {
client.invalidateQueries({ queryKey: ['projects'] });
toast.success(t('projects.created', { title: p.title }));
goto(agentDeepLink(p.id, 'script'));
}
const ideaMutation = createMutation({
mutationFn: () =>
projects.create({
title: ideaForm.title.trim(),
idea: ideaForm.idea.trim() || undefined,
genre: ideaForm.genre || undefined,
tone: ideaForm.tone || undefined,
target_duration: ideaForm.duration || undefined,
}),
onSuccess: onIdeaCreated,
onError: (err) => {
toast.error(err instanceof Error ? err.message : t('projects.createFailed'));
},
});
const scriptMutation = createMutation({
mutationFn: () =>
projects.create({
title: scriptForm.title.trim(),
idea: scriptForm.script.trim(),
}),
onSuccess: onScriptCreated,
onError: (err) => {
toast.error(err instanceof Error ? err.message : t('projects.createFailed'));
},
});
function submitIdea(e: Event) {
e.preventDefault();
showErrors = true;
if (Object.keys(ideaErrors).length || $ideaMutation.isPending) return;
$ideaMutation.mutate();
}
function submitScript(e: Event) {
e.preventDefault();
showErrors = true;
if (Object.keys(scriptErrors).length || $scriptMutation.isPending) return;
$scriptMutation.mutate();
}
// ------------------------------------------------------------------
// Right task area — real queue records only (spec §5 four states).
// ------------------------------------------------------------------
const recentJobs = $derived(($jobsQuery.data ?? []).slice(0, 10));
const activeJobCount = $derived(
($jobsQuery.data ?? []).filter((j) => j.status === 'pending' || j.status === 'running').length,
);
const projectTitles = $derived.by(() => {
const map = new Map<number, string>();
for (const p of allProjects) map.set(p.id, p.title);
return map;
});
const retryMutation = createMutation({
mutationFn: (id: number) => jobsApi.retry(id),
onSuccess: () => {
client.invalidateQueries({ queryKey: ['jobs'] });
toast.success(t('home.jobRequeued'));
},
onError: (err) => {
toast.error(err instanceof Error ? err.message : t('home.jobRetryFailed'));
},
});
const KIND_KEY: Record<string, string> = {
image: 'home.kindImage',
video: 'home.kindVideo',
export: 'home.kindExport',
};
function jobStatusLabel(status: string): string {
if (status === 'done') return t('home.jobDone');
if (status === 'running') return t('home.jobRunning');
if (status === 'pending') return t('home.jobQueued');
if (status === 'failed') return t('home.jobFailed');
return status;
}
function formatJobTime(iso: string): string {
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return '';
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
// English values are the backend contract; display labels come from the
// dictionary — same mapping as the legacy projects page.
function genreKey(value: string): string {
const map: Record<string, string> = {
'Adventure / Mystery': 'adventure',
Drama: 'drama',
'Sci-Fi': 'scifi',
Fantasy: 'fantasy',
Horror: 'horror',
Romance: 'romance',
Thriller: 'thriller',
};
return map[value] ?? 'adventure';
}
function toneKey(value: string): string {
const map: Record<string, string> = {
'Cinematic, atmospheric': 'cinematic',
'Dark, tense': 'dark',
'Whimsical, warm': 'whimsical',
'Gritty, realistic': 'gritty',
'Epic, sweeping': 'epic',
};
return map[value] ?? 'cinematic';
}
function durationKey(value: string): string {
const map: Record<string, string> = {
'30 seconds': '30',
'1 minute': '1m',
'2 minutes': '2m',
'5 minutes': '5m',
'10 minutes': '10',
};
return map[value] ?? '2m';
}
</script>
<AppShell active="projects" title={t('home.title')} subtitle={t('home.subtitle')}>
{#snippet actions()}
<span class="chip">{t('home.projectCount', { n: allProjects.length, m: inProgressCount })}</span
>
<button
class="entry-btn"
class:primary={entryMode === 'none'}
class:secondary={entryMode !== 'none'}
onclick={openIdea}
>
<Icon name="sparkle" size={14} />
{t('home.startIdea')}
</button>
{/snippet}
<div class="home">
<section class="main-col">
{#if entryMode === 'none'}
<div class="entries">
<article class="entry-card">
<span class="entry-icon"><Icon name="sparkle" size={18} /></span>
<h2>{t('home.entryIdeaTitle')}</h2>
<p>{t('home.entryIdeaBody')}</p>
<button type="button" class="entry-btn secondary full" onclick={openIdea}>
{t('home.startIdea')}
</button>
</article>
<article class="entry-card">
<span class="entry-icon"><Icon name="script" size={18} /></span>
<h2>{t('home.entryScriptTitle')}</h2>
<p>{t('home.entryScriptBody')}</p>
<button type="button" class="entry-btn secondary full" onclick={openScript}>
{t('home.importScript')}
</button>
</article>
</div>
{:else if entryMode === 'idea'}
<form class="entry-form" onsubmit={submitIdea}>
<div class="form-head">
<h2>{t('home.entryIdeaTitle')}</h2>
<button
type="button"
class="icon-btn"
aria-label={t('projects.close')}
onclick={closeEntry}
>
<Icon name="close" size={16} />
</button>
</div>
<label class="f-field">
<span class="f-label">{t('projects.titleField')}<em>*</em></span>
<input
class="f-input"
class:invalid={showErrors && ideaErrors.title}
bind:value={ideaForm.title}
placeholder={t('projects.titlePlaceholder')}
/>
{#if showErrors && ideaErrors.title}<span class="f-error">{ideaErrors.title}</span>{/if}
</label>
<label class="f-field">
<span class="f-label">{t('projects.ideaField')}</span>
<textarea
class="f-input textarea"
bind:value={ideaForm.idea}
placeholder={t('home.ideaPlaceholder')}
rows={4}
></textarea>
<span class="f-hint">{t('projects.ideaHint')}</span>
</label>
<div class="f-grid">
<label class="f-field">
<span class="f-label">{t('projects.genre')}</span>
<select class="f-input" bind:value={ideaForm.genre}>
{#each GENRES as v (v)}<option value={v}>{t('genres.' + genreKey(v))}</option
>{/each}
</select>
</label>
<label class="f-field">
<span class="f-label">{t('projects.tone')}</span>
<select class="f-input" bind:value={ideaForm.tone}>
{#each TONES as v (v)}<option value={v}>{t('tones.' + toneKey(v))}</option>{/each}
</select>
</label>
<label class="f-field">
<span class="f-label">{t('projects.duration')}</span>
<select class="f-input" bind:value={ideaForm.duration}>
{#each DURATIONS as v (v)}<option value={v}
>{t('durations.' + durationKey(v))}</option
>{/each}
</select>
</label>
</div>
<div class="form-actions">
<Button variant="ghost" onclick={closeEntry}>{t('projects.cancel')}</Button>
<Button variant="primary" type="submit" loading={$ideaMutation.isPending}>
{t('projects.create')}
</Button>
</div>
</form>
{:else}
<form class="entry-form" onsubmit={submitScript}>
<div class="form-head">
<h2>{t('home.entryScriptTitle')}</h2>
<button
type="button"
class="icon-btn"
aria-label={t('projects.close')}
onclick={closeEntry}
>
<Icon name="close" size={16} />
</button>
</div>
<label class="f-field">
<span class="f-label">{t('projects.titleField')}<em>*</em></span>
<input
class="f-input"
class:invalid={showErrors && scriptErrors.title}
bind:value={scriptForm.title}
placeholder={t('projects.titlePlaceholder')}
/>
{#if showErrors && scriptErrors.title}<span class="f-error">{scriptErrors.title}</span
>{/if}
</label>
<label class="f-field">
<span class="f-label">{t('home.scriptField')}<em>*</em></span>
<textarea
class="f-input textarea"
class:invalid={showErrors && scriptErrors.script}
bind:value={scriptForm.script}
placeholder={t('home.scriptPlaceholder')}
rows={9}
></textarea>
{#if showErrors && scriptErrors.script}<span class="f-error">{scriptErrors.script}</span
>{/if}
<span class="f-hint">{t('home.scriptHint')}</span>
</label>
<div class="form-actions">
<Button variant="ghost" onclick={closeEntry}>{t('projects.cancel')}</Button>
<Button variant="primary" type="submit" loading={$scriptMutation.isPending}>
{t('home.importScript')}
</Button>
</div>
</form>
{/if}
<div class="projects-head">
<h2>{t('home.myProjects')}</h2>
{#if allProjects.length > 0}
<span class="projects-hint">{t('home.myProjectsHint')}</span>
{/if}
</div>
{#if $projectsQuery.isLoading}
<div class="cards" aria-busy="true">
{#each [1, 2, 3] as n (n)}
<div class="skel-card">
<Skeleton height="132px" />
<div class="skel-body">
<Skeleton width="55%" height="15px" />
<Skeleton width="90%" />
<Skeleton width="40%" height="11px" />
</div>
</div>
{/each}
</div>
{:else if $projectsQuery.isError}
<div class="panel-empty error">
<Icon name="alert" size={18} />
<p>{t('projects.loadError')}</p>
<Button variant="secondary" onclick={() => $projectsQuery.refetch()}>
<Icon name="retry" size={14} />
{t('common.retry')}
</Button>
</div>
{:else if allProjects.length === 0}
<div class="panel-empty">
<Icon name="folder" size={20} />
<p>{t('home.emptyProjects')}</p>
</div>
{:else}
<div class="cards">
{#each allProjects as project (project.id)}
<AProjectCard {project} />
{/each}
</div>
{/if}
</section>
<aside class="tasks">
<div class="tasks-head">
<h2>{t('home.tasksTitle')}</h2>
<span class="chip" class:amber={activeJobCount > 0}>
{t('home.activeJobs', { n: activeJobCount })}
</span>
</div>
{#if $jobsQuery.isLoading}
<div class="tasks-loading">{t('common.loading')}…</div>
{:else if recentJobs.length === 0}
<div class="tasks-empty">
<Icon name="queue" size={20} />
<p>{t('home.emptyJobs')}</p>
<p class="tasks-empty-sub">{t('home.emptyJobsSub')}</p>
</div>
{:else}
<ul class="job-list">
{#each recentJobs as job (job.id)}
{@const kindKey = KIND_KEY[job.kind] ?? null}
<li class="job-row" class:failed={job.status === 'failed'}>
<span class="job-main">
{#if kindKey}<span class="tag">{t(kindKey)}</span>{/if}
<span
class="job-name"
title={projectTitles.get(job.project_id) ?? `#${job.project_id}`}
>
{projectTitles.get(job.project_id) ??
t('home.jobProject', { id: job.project_id })}
</span>
</span>
<span class="job-side">
{#if job.status === 'failed' && job.error && job.error !== 'cancelled'}
<span class="job-status mono failed-text" title={job.error}
>{jobStatusLabel(job.status)}</span
>
<button
type="button"
class="retry-link"
onclick={() => $retryMutation.mutate(job.id)}
>
{t('common.retry')}
</button>
{:else}
<span
class="job-status mono {job.status === 'done'
? 'done-text'
: job.status === 'running'
? 'running-text'
: 'queued-text'}"
>
{#if job.status === 'running'}<span class="dot breathe" aria-hidden="true"
></span>{/if}
{jobStatusLabel(job.status)}
</span>
<span class="job-time mono">{formatJobTime(job.created_at)}</span>
{/if}
</span>
</li>
{/each}
</ul>
{/if}
<p class="tasks-note">{t('home.tasksNote')}</p>
</aside>
</div>
</AppShell>
<style>
.home {
display: grid;
grid-template-columns: minmax(0, 1fr) 344px;
gap: 24px;
padding: 24px 28px 40px;
max-width: 1560px;
width: 100%;
box-sizing: border-box;
margin: 0 auto;
align-items: start;
}
.main-col {
min-width: 0;
display: flex;
flex-direction: column;
gap: 22px;
}
/* ---------------- topbar chip + buttons ---------------- */
.chip {
padding: 5px 12px;
border-radius: 999px;
background: var(--surface-3);
color: var(--text-2);
font-size: 11.5px;
white-space: nowrap;
}
.chip.amber {
background: var(--accent-dim);
color: var(--accent);
}
.entry-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 34px;
padding: 0 16px;
border-radius: 8px;
font-family: inherit;
font-size: 13px;
font-weight: 600;
cursor: pointer;
border: 1px solid transparent;
transition:
background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
border-color 150ms,
transform 100ms;
}
.entry-btn.primary {
background: var(--accent);
color: var(--accent-contrast);
}
.entry-btn.primary:hover {
background: var(--accent-hover);
}
.entry-btn.secondary {
background: var(--surface-2);
border-color: var(--border-strong);
color: var(--text);
}
.entry-btn.secondary:hover {
border-color: rgba(255, 255, 255, 0.24);
}
.entry-btn:active {
transform: scale(0.98);
}
.entry-btn.full {
width: 100%;
margin-top: auto;
}
/* ---------------- entry cards / forms (a1 双入口) ---------------- */
.entries {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.entry-card {
display: flex;
flex-direction: column;
gap: 8px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
padding: 18px 20px 20px;
min-height: 168px;
}
.entry-icon {
width: 38px;
height: 38px;
border-radius: 9px;
background: var(--surface-2);
border: 1px solid var(--border-strong);
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--accent);
}
.entry-card h2 {
margin: 4px 0 0;
font-size: 14.5px;
font-weight: 600;
color: var(--text);
}
.entry-card p {
margin: 0;
font-size: 12.5px;
line-height: 1.65;
color: var(--text-2);
}
.entry-form {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
padding: 18px 20px 20px;
}
.form-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 14px;
}
.form-head h2 {
margin: 0;
font-size: 15px;
font-weight: 600;
color: var(--text);
}
.icon-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: none;
border-radius: 7px;
background: transparent;
color: var(--text-3);
cursor: pointer;
}
.icon-btn:hover {
background: var(--surface-3);
color: var(--text);
}
.f-field {
display: block;
margin-bottom: 13px;
}
.f-label {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
font-weight: 600;
color: var(--text-2);
margin-bottom: 6px;
}
.f-label em {
color: var(--error);
font-style: normal;
}
.f-input {
width: 100%;
box-sizing: border-box;
background: var(--surface-2);
border: 1px solid var(--border-strong);
border-radius: 7px;
padding: 9px 11px;
color: var(--text);
font-family: inherit;
font-size: 13px;
}
.f-input.textarea {
resize: vertical;
min-height: 88px;
line-height: 1.6;
}
.f-input:focus {
outline: none;
border-color: rgba(232, 163, 61, 0.6);
}
.f-input.invalid {
border-color: rgba(229, 72, 77, 0.65);
}
.f-hint {
display: block;
margin-top: 5px;
font-size: 11px;
color: var(--text-3);
}
.f-error {
display: block;
margin-top: 5px;
font-size: 11.5px;
color: var(--error);
}
.f-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.f-grid .f-field {
margin-bottom: 0;
}
.form-actions {
display: flex;
justify-content: flex-end;
gap: 8px;
margin-top: 16px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
/* restyle reused ui/Button inside the darkroom scope (§5) */
.home :global(.btn-primary) {
background: var(--accent);
color: var(--accent-contrast);
}
.home :global(.btn-primary:hover:not(:disabled)) {
background: var(--accent-hover);
}
.home :global(.btn-secondary) {
background: var(--surface-2);
border-color: var(--border-strong);
color: var(--text);
}
.home :global(.btn-secondary:hover:not(:disabled)) {
background: var(--surface-3);
}
.home :global(.btn-ghost) {
color: var(--text-2);
}
.home :global(.btn-ghost:hover:not(:disabled)) {
background: var(--surface-3);
color: var(--text);
}
/* ---------------- project cards ---------------- */
.projects-head {
display: flex;
align-items: baseline;
gap: 12px;
}
.projects-head h2 {
margin: 0;
font-size: 14.5px;
font-weight: 600;
color: var(--text);
}
.projects-hint {
font-size: 11.5px;
color: var(--text-3);
}
.cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 16px;
}
.skel-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
overflow: hidden;
}
.skel-card :global(.skeleton) {
border-radius: 0;
}
.skel-body {
display: flex;
flex-direction: column;
gap: 9px;
padding: 14px 16px;
}
.panel-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
padding: 36px 20px;
border: 1.5px dashed var(--border-strong);
border-radius: 10px;
color: var(--text-3);
text-align: center;
}
.panel-empty p {
margin: 0;
font-size: 12.5px;
line-height: 1.65;
color: var(--text-2);
}
.panel-empty.error p {
color: var(--error);
}
/* ---------------- right task area ---------------- */
.tasks {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 10px;
padding: 16px 18px 14px;
position: sticky;
top: 24px;
display: flex;
flex-direction: column;
gap: 12px;
min-width: 0;
}
.tasks-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.tasks-head h2 {
margin: 0;
font-size: 14px;
font-weight: 600;
color: var(--text);
white-space: nowrap;
}
.tasks-loading {
color: var(--text-3);
font-size: 12px;
padding: 12px 0;
}
.tasks-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
padding: 22px 10px 16px;
color: var(--text-3);
text-align: center;
}
.tasks-empty p {
margin: 0;
font-size: 12px;
line-height: 1.65;
color: var(--text-2);
}
.tasks-empty-sub {
font-size: 11px;
color: var(--text-3);
}
.job-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}
.job-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 10px 0;
border-bottom: 1px solid var(--border);
min-height: 44px;
}
.job-row:last-child {
border-bottom: none;
}
.job-main {
display: inline-flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.tag {
padding: 1px 8px;
border-radius: 999px;
background: var(--info-dim);
color: var(--info);
font-size: 10.5px;
font-weight: 600;
flex-shrink: 0;
}
.job-name {
font-size: 12.5px;
color: var(--text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.job-side {
display: inline-flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.job-status {
display: inline-flex;
align-items: center;
gap: 5px;
font-size: 11px;
}
.done-text {
color: var(--success);
}
.running-text {
color: var(--accent);
}
.queued-text {
color: var(--text-3);
}
.failed-text {
color: var(--error);
max-width: 120px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 10px var(--accent-glow);
}
.dot.breathe {
animation: breathe 2s ease-in-out infinite;
}
@keyframes breathe {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.35;
}
}
.job-time {
font-size: 10.5px;
color: var(--text-3);
}
.retry-link {
background: none;
border: none;
padding: 0;
font-family: inherit;
font-size: 11px;
color: var(--error);
cursor: pointer;
text-decoration: underline;
text-underline-offset: 3px;
}
.tasks-note {
margin: 0;
padding-top: 10px;
border-top: 1px solid var(--border);
font-size: 10.5px;
line-height: 1.6;
color: var(--text-3);
}
/* ---------------- responsive ---------------- */
@media (max-width: 1439px) {
.home {
grid-template-columns: minmax(0, 1fr) 320px;
padding: 20px 22px 36px;
}
}
@media (max-width: 1023px) {
.home {
grid-template-columns: minmax(0, 1fr);
padding: 16px 16px 32px;
}
.tasks {
position: static;
}
.entries {
grid-template-columns: minmax(0, 1fr);
}
.f-grid {
grid-template-columns: minmax(0, 1fr);
}
}
</style>
+2 -3
View File
@@ -1,8 +1,7 @@
import { redirect } from '@sveltejs/kit';
export const prerender = false;
export const ssr = false;
// The root route is the A「片场暗房」项目总览 (HEL-608) — no redirect.
export function load() {
redirect(302, '/agents');
return {};
}
+37 -73
View File
@@ -1,12 +1,13 @@
<script lang="ts">
import { createMutation, createQuery, useQueryClient } from '@tanstack/svelte-query';
import { fade } from 'svelte/transition';
import AppHeader from '$lib/components/AppHeader.svelte';
import AppShell from '$lib/components/shell/AppShell.svelte';
import Button from '$lib/components/ui/Button.svelte';
import ConfirmDialog from '$lib/components/ui/ConfirmDialog.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import EmptyState from '$lib/components/ui/EmptyState.svelte';
import { settings, type LlmProfile, type Settings } from '$lib/api';
import { randomId } from '$lib/ids';
import { toast } from '$lib/toast';
import { t } from '$lib/i18n.svelte';
@@ -230,7 +231,7 @@
list = [
...base,
{
id: crypto.randomUUID(),
id: randomId(),
name: form.name.trim(),
base_url: form.baseUrl.trim(),
model: form.model.trim(),
@@ -255,9 +256,7 @@
// Carry the passing test over so the new card shows 已连接.
if (formTest?.ok) {
const id =
formMode === 'edit' && editingId
? editingId
: (saved.llm_profiles.at(-1)?.id ?? '');
formMode === 'edit' && editingId ? editingId : (saved.llm_profiles.at(-1)?.id ?? '');
if (id) recordTest(id, { ok: true, ms: formTest.ms, at: Date.now(), fails: 0 });
}
toast.success(t('models.saved'));
@@ -390,7 +389,13 @@
char: string;
dark?: boolean;
}[] = [
{ role: 'story', labelKey: 'models.agentStory', color: 'var(--avatar-1)', char: '剧', dark: true },
{
role: 'story',
labelKey: 'models.agentStory',
color: 'var(--avatar-1)',
char: '剧',
dark: true,
},
{ role: 'style', labelKey: 'models.agentStyle', color: 'var(--avatar-2)', char: '视' },
{ role: 'script', labelKey: 'models.agentScript', color: 'var(--avatar-3)', char: '分' },
{ role: 'assets', labelKey: 'models.agentAssets', color: 'var(--avatar-4)', char: '素' },
@@ -430,8 +435,7 @@
if (m) {
const a = Number(m[1]);
const b = Number(m[2]);
if (a === 10 || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168))
return 'lan';
if (a === 10 || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168)) return 'lan';
if (a === 169 && b === 254) return 'lan';
return 'cloud';
}
@@ -468,13 +472,27 @@
});
</script>
<svelte:head>
<title>{t('models.title')}</title>
</svelte:head>
<AppShell active="models" title={t('models.title')} subtitle={t('models.subtitle')}>
{#snippet actions()}
{#if !$settingsQuery.isLoading && $settingsQuery.data}
{@const profiles = $settingsQuery.data.llm_profiles}
{@const availableCount = profiles.filter((p) => tests[p.id]?.ok).length}
<span class="status-chip">
{t('models.statusCount', { n: profiles.length, m: availableCount })}
</span>
{/if}
<button
class="a-btn"
class:primary={formMode === 'idle'}
class:secondary={formMode !== 'idle'}
onclick={startAdd}
>
<Icon name="plus" size={14} />
{t('models.add')}
</button>
{/snippet}
<div class="shell">
<AppHeader active="models" />
<div class="a-darkroom page">
<div class="page">
{#if $settingsQuery.isLoading}
<p class="loading">{t('models.loading')}</p>
{:else if !$settingsQuery.data}
@@ -483,23 +501,6 @@
{@const s = $settingsQuery.data}
{@const profiles = s.llm_profiles}
{@const activeId = s.llm_active_id ?? profiles[0]?.id ?? ''}
{@const availableCount = profiles.filter((p) => tests[p.id]?.ok).length}
<header class="page-head">
<div class="head-copy">
<h1>{t('models.title')}</h1>
<p class="sub">{t('models.subtitle')}</p>
</div>
<div class="head-actions">
<span class="status-chip">
{t('models.statusCount', { n: profiles.length, m: availableCount })}
</span>
<button class="a-btn" class:primary={formMode === 'idle'} class:secondary={formMode !== 'idle'} onclick={startAdd}>
<Icon name="plus" size={14} />
{t('models.add')}
</button>
</div>
</header>
<div class="tabs" role="tablist" aria-label={t('models.title')}>
<span class="tab active" role="tab" aria-selected="true">
@@ -644,7 +645,9 @@
<option value="">{t('models.agentDefault')}</option>
{#each profiles as p (p.id)}
<option value={p.id} class:unavailable={tests[p.id]?.ok === false}>
{p.name} — {p.model}{tests[p.id]?.ok === false ? t('models.unavailable') : ''}
{p.name} — {p.model}{tests[p.id]?.ok === false
? t('models.unavailable')
: ''}
</option>
{/each}
</select>
@@ -831,7 +834,7 @@
</div>
{/if}
</div>
</div>
</AppShell>
<ConfirmDialog
bind:open={deleteOpen}
@@ -844,20 +847,12 @@
/>
<style>
.shell {
min-height: 100vh;
display: flex;
flex-direction: column;
}
.page {
flex: 1;
min-height: 0;
padding: 24px 28px 40px;
max-width: 1560px;
width: 100%;
box-sizing: border-box;
margin: 0 auto;
overflow-y: auto;
}
.loading {
@@ -868,31 +863,7 @@
color: var(--error);
}
/* ---------------- page header (§9.1) ---------------- */
.page-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
}
.page-head h1 {
margin: 0;
font-size: 20px;
font-weight: 600;
color: var(--text);
}
.sub {
margin: 4px 0 0;
font-size: 12.5px;
color: var(--text-3);
}
.head-actions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
/* ---------------- topbar chip + button (§9.1, rendered in AppShell) ---------------- */
.status-chip {
padding: 5px 12px;
border-radius: 999px;
@@ -1572,13 +1543,6 @@
.page {
padding: 16px 16px 32px;
}
.page-head {
flex-direction: column;
}
.head-actions {
width: 100%;
justify-content: space-between;
}
/* single column: cards → form → notice → agents list */
.form-col {
position: static;
@@ -11,6 +11,7 @@
import Icon from '$lib/components/ui/Icon.svelte';
import StatusChip from '$lib/components/ui/StatusChip.svelte';
import { settings, type LlmProfile, type Settings } from '$lib/api';
import { randomId } from '$lib/ids';
import { toast } from '$lib/toast';
import { t } from '$lib/i18n.svelte';
@@ -326,7 +327,7 @@
function addProfile(s: Settings) {
ensureLlmDraft(s);
const id = crypto.randomUUID();
const id = randomId();
draft.llm_profiles = [
...(draft.llm_profiles as LlmProfile[]),
{