HEL-665: implement approved reference creative and agent interfaces

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-14 22:03:32 +08:00
co-authored by multica-agent
parent ae9e34f6ab
commit d4e199f3c8
31 changed files with 4869 additions and 1488 deletions
@@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import { spotlight } from '$lib/actions/spotlight';
import { createQuery } from '@tanstack/svelte-query';
import { toStore } from 'svelte/store';
import { page } from '$app/state';
@@ -47,10 +48,13 @@
staleTime: 5_000,
});
const genJobs = $derived(
($activeJobsQuery.data ?? []).filter((j) => j.kind === 'image' || j.kind === 'video'),
($activeJobsQuery.data ?? []).filter(
(j) => j.kind === 'image' || j.kind === 'video',
),
);
const activeJobs = $derived(
genJobs.filter((j) => j.status === 'pending' || j.status === 'running').length,
genJobs.filter((j) => j.status === 'pending' || j.status === 'running')
.length,
);
// The ACTIVE ComfyUI connection (HEL-611). Its status dot comes from a
@@ -59,11 +63,17 @@
const activeEndpoint = $derived.by(() => {
const s = $settingsQuery.data;
if (!s) return null;
return s.comfyui_endpoints?.find((ep) => ep.id === s.comfyui_active_id) ?? null;
return (
s.comfyui_endpoints?.find((ep) => ep.id === s.comfyui_active_id) ?? null
);
});
const comfyUrl = $derived.by(() => {
const raw = (activeEndpoint?.base_url ?? $settingsQuery.data?.comfyui_base_url ?? '').trim();
const raw = (
activeEndpoint?.base_url ??
$settingsQuery.data?.comfyui_base_url ??
''
).trim();
if (!raw) return '';
try {
const u = new URL(raw.includes('://') ? raw : `http://${raw}`);
@@ -126,7 +136,11 @@
}
function handleGlobalKeydown(event: KeyboardEvent) {
if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === 'k') {
if (
(event.ctrlKey || event.metaKey) &&
!event.altKey &&
event.key.toLowerCase() === 'k'
) {
event.preventDefault();
paletteOpen = !paletteOpen;
}
@@ -149,17 +163,18 @@
href: '/image',
label: '创作台',
icon: 'image',
match: (p: string) => ['/image', '/video', '/playground', '/build-scene'].includes(p),
match: (p: string) =>
['/image', '/video', '/playground', '/build-scene'].includes(p),
},
{
href: '/canvas',
label: '灵感画布',
label: '画布',
icon: 'story',
match: (p: string) => p.startsWith('/canvas'),
},
{
href: '/library',
label: '素材与工作流',
label: '素材库',
icon: 'assets',
match: (p: string) => ['/library', '/workflows'].includes(p),
},
@@ -171,7 +186,13 @@
},
] as const;
let focus = $state(false);
let expanded = $state(false);
function toggleNavigation() {
expanded = !expanded;
localStorage.setItem('calliope.reference.navigation', String(expanded));
}
onMount(() => {
expanded = localStorage.getItem('calliope.reference.navigation') === 'true';
const listener = (e: Event) => {
focus = (e as CustomEvent<boolean>).detail;
};
@@ -181,76 +202,106 @@
</script>
<svelte:head
><title>{title} · 折光工作室</title><meta name="color-scheme" content="light" /></svelte:head
><title>{title} · AIGC工作台</title><meta
name="color-scheme"
content="dark"
/></svelte:head
>
<svelte:window onkeydown={handleGlobalKeydown} />
<div class="refract-shell" class:focus>
<aside class="sidebar">
<div class="refract-shell" class:focus class:expanded>
<aside class="sidebar" aria-label="全站导航">
<a class="brand" href="/" aria-label="返回工作室"
><span class="brand-mark">✦</span><span>折光<small>REFRACT STUDIO</small></span></a
>AIGC{#if expanded}<small>创作工作台</small>{/if}</a
>
<div class="workspace">
<span class="workspace-dot"></span>我的创作空间
<span class="mini">个人</span>
</div>
<div class="nav-label">创作,从这里开始</div>
<nav aria-label="主要导航">
{#each mainNav as item}<a
class="nav-item"
class="nav-item reference-option"
use:spotlight
href={item.href}
aria-current={item.match(page.url.pathname) ? 'page' : undefined}
><Icon name={item.icon} size={18} /><span>{item.label}</span></a
title={item.label}
><Icon name={item.icon} size={20} /><span>{item.label}</span></a
>{/each}
</nav>
<div class="sidebar-note">
<span class="note-symbol">✳</span>
<p>每个想法,<br />都有自己的光。</p>
<a href="/canvas">去画布上探索 <span>↗</span></a>
</div>
<div class="sidebar-bottom">
<div class="utility-links">
<a href="/tasks"
>生成任务{#if activeJobs > 0}<b>{activeJobs}</b>{/if}</a
><a href="/models">模型</a><a href="/settings">设置</a>
</div>
<a class="connection" href="/connections" title={connDetail}
><span class="status-chip-dot {connDot}"></span>{probeState === 'ok'
? '本地服务已连接'
: probeState === 'testing'
? '正在检测本地服务'
: probeState === 'fail'
? '本地服务离线'
: '配置本地服务'} <span>↗</span></a
<button
class="nav-item reference-option"
use:spotlight
onclick={toggleNavigation}
aria-expanded={expanded}
title={expanded ? '收起导航' : '展开导航'}
><Icon name="chevron-right" size={18} /><span
>{expanded ? '收起导航' : '展开导航'}</span
></button
>
<a
class="nav-item reference-option"
use:spotlight
href="/tasks"
title="生成任务"
><Icon name="clock" size={18} /><span
>任务{#if activeJobs > 0}<b>{activeJobs}</b>{/if}</span
></a
>
<a
class="nav-item reference-option"
use:spotlight
href="/models"
title="模型与接口"><Icon name="link" size={18} /><span>模型</span></a
>
<a
class="nav-item reference-option"
use:spotlight
href="/settings"
title="设置"><Icon name="settings" size={18} /><span>设置</span></a
>
<a
class="connection"
href="/connections"
title={connDetail}
aria-label={connDetail}
><span class="status-chip-dot {connDot}"></span>{#if expanded}<span
>{probeState === 'ok'
? '本地服务已连接'
: probeState === 'testing'
? '正在检测服务'
: probeState === 'fail'
? '本地服务离线'
: '配置本地服务'}</span
>{/if}</a
>
<div class="accessibility">
<label
><Switch
checked={reduceMotion.system || reduceMotion.manual}
disabled={reduceMotion.system}
label={t('shell.reduceMotion')}
onchange={setReduceMotion}
/><span>减少动效</span></label
><LanguageSwitcher />
</div>
</div>
</aside>
<div class="app-body">
<header class="topbar">
<div class="breadcrumb">
{mainNav.find((n) => n.match(page.url.pathname))?.label ?? title}<span>/</span><span
class="page-name">{title}</span
>
{mainNav.find((n) => n.match(page.url.pathname))?.label ?? title}<span
>/</span
><span class="page-name">{title}</span>
</div>
<div class="grow"></div>
{#if scopeProjectId}<ProjectScope projectId={scopeProjectId} onProjectsList={false} />{/if}
{#if scopeProjectId}<ProjectScope
projectId={scopeProjectId}
onProjectsList={false}
/>{/if}
{#if actions}<div class="topbar-actions">{@render actions()}</div>{/if}
<button
class="search-trigger"
onclick={openPalette}
aria-label={t('shell.searchTitle')}
aria-keyshortcuts="Control+K Meta+K"
><Icon name="search" size={16} /><span>寻找项目与灵感</span><kbd>Ctrl K</kbd></button
><QueueTray jobs={genJobs} />
><Icon name="search" size={16} /><span>搜索</span><kbd>Ctrl K</kbd
></button
>
<label class="motion"
><Switch
checked={reduceMotion.system || reduceMotion.manual}
disabled={reduceMotion.system}
label={t('shell.reduceMotion')}
onchange={setReduceMotion}
/><span>减少动效</span></label
>
<LanguageSwitcher /><QueueTray jobs={genJobs} />
</header>
<div class="body" class:bounded={workspace}>{@render children?.()}</div>
</div>
@@ -262,173 +313,129 @@
position: fixed;
inset: 0;
display: grid;
grid-template-columns: 214px minmax(0, 1fr);
grid-template-columns: 78px minmax(0, 1fr);
background: var(--bg);
min-width: 0;
color: var(--text);
min-width: 0;
}
.refract-shell.expanded {
grid-template-columns: 174px minmax(0, 1fr);
}
.sidebar {
background: var(--surface);
background: linear-gradient(#141419, #0f0f12);
border-right: 1px solid var(--line);
padding: 27px 20px 16px;
padding: 16px 8px 9px;
display: flex;
flex-direction: column;
min-height: 0;
overflow: auto;
scrollbar-width: thin;
}
.brand {
display: flex;
align-items: center;
text-align: left;
gap: 12px;
font-weight: 750;
font-size: 25px;
letter-spacing: -1px;
font-size: 19px;
font-weight: 800;
color: var(--accent);
text-align: center;
text-decoration: none;
color: var(--text);
letter-spacing: -1px;
display: block;
margin: 6px 0 28px;
text-shadow: 0 0 20px #00cae044;
}
.brand small {
display: block;
font-size: 9px;
letter-spacing: 1.5px;
font-weight: 500;
margin-top: 1px;
}
.brand-mark {
width: 44px;
height: 48px;
display: grid;
place-items: center;
background: var(--accent);
border-radius: 14px;
color: var(--surface);
font-size: 36px;
}
.workspace {
display: flex;
align-items: center;
gap: 7px;
margin: 34px 0 32px;
font-size: 12px;
}
.workspace-dot {
background: #8a9c52;
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
}
.mini {
font-size: 10px;
padding: 2px 5px;
border: 1px solid var(--line);
border-radius: 4px;
margin-left: auto;
color: var(--text-3);
}
.nav-label {
font-size: 10px;
font-weight: 600;
color: var(--text-3);
letter-spacing: 1px;
padding: 0 9px;
margin-bottom: 12px;
color: var(--text-3);
font-weight: 400;
margin-top: 4px;
}
nav {
display: grid;
gap: 6px;
.sidebar nav {
display: flex;
flex-direction: column;
gap: 7px;
}
.nav-item {
height: 43px;
min-height: 58px;
display: flex;
gap: 12px;
flex-direction: column;
justify-content: center;
align-items: center;
border-radius: 9px;
padding: 0 12px;
color: #686963;
font-size: 13px;
gap: 7px;
font-size: 10px;
padding: 9px 3px;
color: #90949b;
text-decoration: none;
border: 0;
background: none;
border-radius: 11px;
cursor: pointer;
font-family: inherit;
transition:
background-color 160ms ease,
background-color 180ms ease,
color 180ms ease,
transform 160ms var(--ease-out);
flex-shrink: 0;
}
.nav-item[aria-current='page'] {
background: #e8eafe;
color: var(--accent);
font-weight: 600;
background: #00cae01d;
}
.nav-item[aria-current='page']::before {
content: '';
position: absolute;
bottom: 5px;
width: 18px;
height: 2px;
border-radius: 3px;
background: var(--accent);
}
.nav-item:active {
transform: scale(0.97);
transform: scale(var(--press-scale));
}
.sidebar-note {
margin-top: auto;
padding: 32px 12px 25px;
border-bottom: 1px solid var(--line);
}
.note-symbol {
font-size: 45px;
line-height: 1;
.nav-item b {
font-size: 9px;
color: var(--accent);
display: block;
margin-bottom: 13px;
margin-left: 3px;
}
.sidebar-note p {
font-size: 18px;
letter-spacing: 1px;
font-weight: 550;
margin: 0 0 16px;
.expanded .nav-item {
flex-direction: row;
justify-content: flex-start;
gap: 12px;
font-size: 12px;
padding: 10px 14px;
min-height: 43px;
}
.sidebar-note a {
font-size: 11px;
color: var(--text-3);
display: flex;
justify-content: space-between;
text-decoration: none;
.expanded .nav-item::before {
display: none;
}
.sidebar-bottom {
padding-top: 20px;
font-size: 10px;
color: var(--text-3);
}
.utility-links {
display: flex;
gap: 14px;
align-items: center;
margin-bottom: 16px;
flex-direction: column;
gap: 2px;
margin-top: auto;
padding-top: 18px;
}
.utility-links a {
color: inherit;
text-decoration: none;
.sidebar-bottom .nav-item {
min-height: 45px;
font-size: 9px;
padding: 7px 3px;
gap: 4px;
}
.utility-links b {
margin-left: 5px;
color: var(--accent);
.expanded .sidebar-bottom .nav-item {
min-height: 39px;
padding: 9px 14px;
font-size: 12px;
}
.connection {
display: flex;
gap: 6px;
align-items: center;
color: inherit;
text-decoration: none;
}
.connection > span:last-child {
margin-left: auto;
}
.accessibility {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 16px;
}
.accessibility label {
display: flex;
gap: 5px;
align-items: center;
}
.accessibility :global(.lang-switcher) {
max-width: 50px;
justify-content: center;
gap: 8px;
padding: 8px;
color: var(--text-3);
font-size: 10px;
text-decoration: none;
}
.app-body {
display: flex;
@@ -437,116 +444,114 @@
min-width: 0;
}
.topbar {
min-height: 77px;
height: 54px;
flex-shrink: 0;
background: #141419;
border-bottom: 1px solid var(--line);
display: flex;
align-items: center;
padding: 0 36px;
gap: 16px;
flex-shrink: 0;
z-index: 20;
gap: 12px;
padding: 0 20px;
}
.breadcrumb {
font-size: 12px;
font-weight: 500;
display: flex;
align-items: center;
gap: 13px;
min-width: 0;
}
.breadcrumb > span {
gap: 10px;
color: var(--text-3);
font-weight: 400;
font-size: 11px;
}
.page-name {
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--text-2);
}
.grow {
flex: 1;
}
.topbar-actions {
display: flex;
gap: 10px;
align-items: center;
gap: 8px;
}
.search-trigger {
border: 0;
background: none;
color: var(--text-3);
display: flex;
gap: 10px;
align-items: center;
gap: 6px;
color: var(--text-3);
border: 1px solid var(--line);
background: #1b1c21;
padding: 6px 10px;
border-radius: 7px;
font-size: 11px;
cursor: pointer;
white-space: nowrap;
}
kbd {
font: inherit;
.search-trigger kbd {
font-size: 9px;
border: 1px solid var(--line);
padding: 2px 5px;
border-radius: 4px;
color: #66717a;
margin-left: 8px;
}
.motion {
display: flex;
align-items: center;
gap: 6px;
font-size: 10px;
color: var(--text-3);
}
.body {
flex: 1;
min-height: 0;
overflow: auto;
overscroll-behavior: contain;
}
.body.bounded {
overflow: hidden;
}
.focus {
grid-template-columns: 1fr;
display: flex;
flex-direction: column;
}
.focus .sidebar,
.focus .topbar {
display: none;
}
@media (hover: hover) {
.refract-shell.focus {
grid-template-columns: minmax(0, 1fr);
}
@media (hover: hover) and (pointer: fine) {
.nav-item:hover {
background: #ededdf;
background-color: #ffffff09;
color: #e0e7f0;
}
.nav-item[aria-current='page']:hover {
background: #e8eafe;
}
.sidebar-note a:hover,
.utility-links a:hover {
color: var(--accent);
.search-trigger:hover {
border-color: var(--line-2);
}
}
@media (max-width: 1250px) {
.refract-shell {
grid-template-columns: 182px minmax(0, 1fr);
}
.sidebar {
padding: 24px 15px 16px;
}
@media (max-width: 1150px) {
.topbar {
padding: 0 25px;
gap: 8px;
padding: 0 14px;
}
.search-trigger > span {
.search-trigger kbd {
display: none;
}
.page-name {
max-width: 160px;
.breadcrumb .page-name {
max-width: 180px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
@media (max-height: 780px) {
.sidebar-note {
padding-top: 24px;
@media (max-height: 760px) {
.sidebar {
padding-top: 11px;
}
.note-symbol {
font-size: 32px;
.brand {
margin-bottom: 18px;
}
.sidebar-note p {
font-size: 16px;
.nav-item {
min-height: 51px;
}
.workspace {
margin: 24px 0;
.sidebar-bottom {
gap: 0;
padding-top: 12px;
}
.sidebar-bottom .nav-item {
min-height: 37px;
}
}
</style>