fix(HEL-730): preserve shared pins and sample icon geometry

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-22 01:51:42 +08:00
co-authored by multica-agent
parent 03bebec94a
commit 64c1116bca
12 changed files with 246 additions and 266 deletions
@@ -12,23 +12,10 @@
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 {
apiErrorMessage,
comfy,
settings,
workflows,
type ComfyEndpoint,
type WorkflowMeta,
} from "$lib/api";
import { comfy, settings, workflows, type ComfyEndpoint } from "$lib/api";
import { toast } from "$lib/toast";
import { t } from "$lib/i18n.svelte";
import {
classifyEndpoint,
endpointTypeLabel,
type EndpointKind,
} from "$lib/endpointKind";
const client = useQueryClient();
@@ -375,51 +362,11 @@
},
});
// ------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------
function formatTime(at: number): string {
return new Date(at).toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
});
}
function tokenTail(ep: ComfyEndpoint): string {
const tail = ep.token_tail ?? "";
return tail ? `****${tail}` : "";
}
function endpointName(id: string | null | undefined): string | null {
if (!id) return null;
return endpoints.find((ep) => ep.id === id)?.name ?? null;
}
// 任务使用目标 (a6): where each kind of job actually runs — a workflow's
// own binding first, otherwise the default connection.
function kindTarget(kind: "image" | "video" | null): {
value: string;
kind: EndpointKind | null;
} {
const wfs: WorkflowMeta[] = ($wfMetaQuery.data ?? []).filter(
(w) => kind === null || w.kind === kind,
);
const ids = new Set(
wfs.map((w) => w.endpoint_id || activeId).filter(Boolean),
);
if (wfs.length === 0) ids.add(activeId);
if (ids.size === 1) {
const ep = endpoints.find((e) => e.id === [...ids][0]);
if (ep) return { value: ep.name, kind: classifyEndpoint(ep.base_url) };
}
return { value: t("conn.targetMixed", { n: ids.size }), kind: null };
}
const targetRows = $derived.by(() => [
{ key: "image", label: t("conn.targetImage"), ...kindTarget("image") },
{ key: "video", label: t("conn.targetVideo"), ...kindTarget("video") },
{ key: "flow", label: t("conn.targetFlow"), ...kindTarget(null) },
]);
loadTests();
$effect(() => {
// prune stale test records once the endpoint list is known
@@ -11,12 +11,10 @@
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";
import { classifyEndpoint, endpointTypeLabel } from "$lib/endpointKind";
const client = useQueryClient();
@@ -503,16 +501,6 @@
$assignMutation.mutate({ [role]: value === "" ? null : value });
}
// ------------------------------------------------------------------
// Helpers
// ------------------------------------------------------------------
function formatTime(at: number): string {
return new Date(at).toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
});
}
function keyTail(profile: LlmProfile): string {
const tail = profile.api_key_tail ?? "";
return tail ? `sk-****${tail}` : "";
@@ -546,8 +534,7 @@
正在读取模型…
</p>{:else if !$settingsQuery.data}<p class="mg-empty" role="alert">
模型加载失败<Button onclick={() => $settingsQuery.refetch()}>重试</Button>
</p>{:else}{@const s = $settingsQuery.data}{@const profiles =
s.llm_profiles}{@const activeId = s.llm_active_id}
</p>{:else}{@const s = $settingsQuery.data}{@const profiles = s.llm_profiles}
<div class="mg-cards">
{#each profiles as profile (profile.id)}{@const rec = tests[profile.id]}
<article class="mg-card">
@@ -1,5 +1,6 @@
/* HEL-726 approved management primitives. Geometry and colours use theme tokens. */
.management-header {
--icon-stroke: var(--manage-icon-stroke);
letter-spacing: var(--manage-header-letter-spacing);
box-sizing: border-box;
--button-weight: var(--manage-control-weight);
@@ -31,6 +32,7 @@
white-space: nowrap;
}
.management-page {
--icon-stroke: var(--manage-icon-stroke);
box-sizing: border-box;
--button-weight: var(--manage-control-weight);
--button-primary-weight: var(--manage-control-weight);
@@ -724,3 +726,29 @@ textarea.f-input {
.mg-card .mg-muted {
font-size: 12px;
}
.mg-pin {
width: var(--manage-pin-size);
height: var(--manage-pin-size);
padding: 0;
border: 0;
border-radius: var(--manage-pin-radius);
display: grid;
place-items: center;
color: var(--tx-3);
background: transparent;
cursor: pointer;
transition:
color var(--t-fast),
background var(--t-fast);
}
.mg-pin:hover {
background: rgb(var(--ink) / 0.08);
color: var(--tx-1);
}
.mg-pin[aria-pressed="true"] {
color: var(--gold);
}
.mg-pin[aria-pressed="true"] svg {
fill: currentColor;
}
+26 -26
View File
@@ -1,37 +1,37 @@
<script lang="ts">
import { icons, type IconName } from './icons';
import { icons, type IconName } from "./icons";
interface Props {
name: IconName;
size?: number;
}
interface Props {
name: IconName;
size?: number;
}
let { name, size = 18 }: Props = $props();
let { name, size = 18 }: Props = $props();
const content = $derived(icons[name] ?? '');
const content = $derived(icons[name] ?? "");
</script>
{#if content}
<svg
class="icon"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
{@html content}
</svg>
<svg
class="icon"
width={size}
height={size}
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
style:stroke-width="var(--icon-stroke, 1.5)"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
{@html content}
</svg>
{/if}
<style>
.icon {
display: inline-block;
vertical-align: -0.125em;
flex-shrink: 0;
}
.icon {
display: inline-block;
vertical-align: -0.125em;
flex-shrink: 0;
}
</style>
+75 -70
View File
@@ -4,76 +4,81 @@
* Each entry is SVG inner content rendered by Icon.svelte via {@html}.
*/
export const icons = {
// Navigation
home: '<path d="m3 10 9-7 9 7v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"/><path d="M9 22V12h6v10"/>',
story:
'<path d="M2 4h6a4 4 0 0 1 4 4v12a3 3 0 0 0-3-3H2z"/><path d="M22 4h-6a4 4 0 0 0-4 4v12a3 3 0 0 1 3-3h7z"/>',
assets:
'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
script:
'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',
video:
'<rect x="2" y="2" width="20" height="20" rx="2.18"/><path d="M7 2v20"/><path d="M17 2v20"/><path d="M2 12h20"/><path d="M2 7h5"/><path d="M2 17h5"/><path d="M17 17h5"/><path d="M17 7h5"/>',
queue:
'<path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/>',
settings:
'<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
playground:
'<path d="M10 2v7.53a2 2 0 0 1-.21.9L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45L14.21 10.4a2 2 0 0 1-.21-.9V2"/><path d="M8.5 2h7"/><path d="M7 16h10"/>',
// Actions
plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
link: '<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',
'link-off':
'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 0 1 2 8"/><path d="m8 8 8 8"/>',
trash:
'<path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6"/><path d="M14 11v6"/>',
edit: '<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/>',
retry:
'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M3 21v-5h5"/>',
close: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
download:
'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>',
upload:
'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>',
paperclip:
'<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>',
copy:
'<rect x="8" y="8" width="14" height="14" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>',
'external-link':
'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><path d="M15 3h6v6"/><path d="M10 14 21 3"/>',
'zoom-in':
'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M11 8v6"/><path d="M8 11h6"/>',
// Media transport
play: '<polygon points="6 3 20 12 6 21 6 3"/>',
pause:
'<rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/>',
stop: '<rect x="5" y="5" width="14" height="14" rx="2"/>',
// Status
check: '<path d="M20 6 9 17l-5-5"/>',
star: '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
alert:
'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
sparkle:
'<path d="M12 3l1.9 5.76a2 2 0 0 0 1.24 1.24L21 12l-5.86 1.9a2 2 0 0 0-1.24 1.24L12 21l-1.9-5.86a2 2 0 0 0-1.24-1.24L3 12l5.86-1.9a2 2 0 0 0 1.24-1.24Z"/>',
// Media
image:
'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>',
film: '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 8h20"/><path d="M2 16h20"/><path d="M9 8v8"/><path d="M15 8v8"/>',
music:
'<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
folder:
'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
file: '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>',
// Chevrons
'chevron-left': '<path d="m15 18-6-6 6-6"/>',
'chevron-right': '<path d="m9 18 6-6-6-6"/>',
'chevron-up': '<path d="m18 15-6-6-6 6"/>',
'chevron-down': '<path d="m6 9 6 6 6-6"/>',
// Misc
drag: '<circle cx="9" cy="6" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="18" r="1"/><circle cx="15" cy="6" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="18" r="1"/>',
"search-manage": '<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>',
"upload-manage": '<path d="M12 16V4M6 9l6-6 6 6M4 20h16"/>',
"film-manage":
'<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M7 4v16M17 4v16M2 9h5M2 15h5M17 9h5M17 15h5"/>',
"arrow-right": '<path d="M5 12h14M13 6l6 6-6 6"/>',
pin: '<path d="M12 17v5M5 17h14l-2-4V5a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v8z"/>',
// Navigation
home: '<path d="m3 10 9-7 9 7v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"/><path d="M9 22V12h6v10"/>',
story:
'<path d="M2 4h6a4 4 0 0 1 4 4v12a3 3 0 0 0-3-3H2z"/><path d="M22 4h-6a4 4 0 0 0-4 4v12a3 3 0 0 1 3-3h7z"/>',
assets:
'<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
script:
'<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/><path d="M16 13H8"/><path d="M16 17H8"/><path d="M10 9H8"/>',
video:
'<rect x="2" y="2" width="20" height="20" rx="2.18"/><path d="M7 2v20"/><path d="M17 2v20"/><path d="M2 12h20"/><path d="M2 7h5"/><path d="M2 17h5"/><path d="M17 17h5"/><path d="M17 7h5"/>',
queue:
'<path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/>',
settings:
'<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>',
playground:
'<path d="M10 2v7.53a2 2 0 0 1-.21.9L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45L14.21 10.4a2 2 0 0 1-.21-.9V2"/><path d="M8.5 2h7"/><path d="M7 16h10"/>',
// Actions
plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
link: '<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',
"link-off":
'<path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 0 1 2 8"/><path d="m8 8 8 8"/>',
trash:
'<path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><path d="M10 11v6"/><path d="M14 11v6"/>',
edit: '<path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/>',
retry:
'<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M3 21v-5h5"/>',
close: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
download:
'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/><path d="M12 15V3"/>',
upload:
'<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m17 8-5-5-5 5"/><path d="M12 3v12"/>',
paperclip:
'<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>',
copy: '<rect x="8" y="8" width="14" height="14" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/>',
"external-link":
'<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><path d="M15 3h6v6"/><path d="M10 14 21 3"/>',
"zoom-in":
'<circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/><path d="M11 8v6"/><path d="M8 11h6"/>',
// Media transport
play: '<polygon points="6 3 20 12 6 21 6 3"/>',
pause:
'<rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/>',
stop: '<rect x="5" y="5" width="14" height="14" rx="2"/>',
// Status
check: '<path d="M20 6 9 17l-5-5"/>',
star: '<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>',
alert:
'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
sparkle:
'<path d="M12 3l1.9 5.76a2 2 0 0 0 1.24 1.24L21 12l-5.86 1.9a2 2 0 0 0-1.24 1.24L12 21l-1.9-5.86a2 2 0 0 0-1.24-1.24L3 12l5.86-1.9a2 2 0 0 0 1.24-1.24Z"/>',
// Media
image:
'<rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.09-3.09a2 2 0 0 0-2.82 0L6 21"/>',
film: '<rect x="2" y="4" width="20" height="16" rx="2"/><path d="M2 8h20"/><path d="M2 16h20"/><path d="M9 8v8"/><path d="M15 8v8"/>',
music:
'<path d="M9 18V5l12-2v13"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/>',
folder:
'<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
file: '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>',
// Chevrons
"chevron-left": '<path d="m15 18-6-6 6-6"/>',
"chevron-right": '<path d="m9 18 6-6-6-6"/>',
"chevron-up": '<path d="m18 15-6-6-6 6"/>',
"chevron-down": '<path d="m6 9 6 6 6-6"/>',
// Misc
drag: '<circle cx="9" cy="6" r="1"/><circle cx="9" cy="12" r="1"/><circle cx="9" cy="18" r="1"/><circle cx="15" cy="6" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="18" r="1"/>',
} as const satisfies Record<string, string>;
export type IconName = keyof typeof icons;
@@ -1,4 +1,6 @@
<script lang="ts">
import { onMount } from "svelte";
import { storageGet, storageSet } from "$lib/storage";
import { isWorkflowRunnable, workflowState } from "$lib/workflowState";
import FamilyBadge from "$lib/components/manage/FamilyBadge.svelte";
import ManagementPage from "$lib/components/manage/ManagementPage.svelte";
@@ -6,7 +8,6 @@
import { createMutation, useQueryClient } from "@tanstack/svelte-query";
import Button from "$lib/components/ui/Button.svelte";
import ConfirmDialog from "$lib/components/ui/ConfirmDialog.svelte";
import EmptyState from "$lib/components/ui/EmptyState.svelte";
import Icon from "$lib/components/ui/Icon.svelte";
import Switch from "$lib/components/ui/Switch.svelte";
import WorkflowImportDrawer from "$lib/components/WorkflowImportDrawer.svelte";
@@ -62,6 +63,32 @@
});
const client = useQueryClient();
let pins = $state<number[]>([]);
onMount(() => {
try {
const saved = JSON.parse(
storageGet("calliope.reference.workflowPins") ?? "[]",
);
pins = Array.isArray(saved)
? saved.filter((id): id is number => typeof id === "number")
: [];
} catch {
pins = [];
}
});
function pin(id: number) {
pins = pins.includes(id)
? pins.filter((value) => value !== id)
: [...pins, id];
storageSet("calliope.reference.workflowPins", JSON.stringify(pins));
}
function inputNodeLabel(wf: Workflow, id: string, label: string): string {
const [nodeId, field] = id.split("@");
const node = wf.workflow_json[nodeId];
const name = typeof node?.class_type === "string" ? node.class_type : label;
return nodeId + " · " + name + (field ? "." + field : "");
}
function invalidateWorkflows() {
return Promise.all([
client.invalidateQueries({ queryKey: ["workflows"] }),
@@ -224,13 +251,11 @@
}
let batchPending = $state(false);
let batchEnableDir = $state<boolean | null>(null);
let metaDialogOpen = $state(false);
let metaTargets = $state<WorkflowMeta[]>([]);
async function batchSetEnabled(enabled: boolean) {
batchPending = true;
batchEnableDir = enabled;
let done = 0;
let failed = 0;
try {
@@ -252,7 +277,6 @@
}
} finally {
batchPending = false;
batchEnableDir = null;
}
invalidateWorkflows();
if (failed === 0) toast.success(t("wl.batchDone", { n: done }));
@@ -557,12 +581,6 @@
searchInput?.focus();
}
function mediaIcon(kind: string): "image" | "film" | "music" {
if (kind === "video") return "film";
if (kind === "audio") return "music";
return "image";
}
function mediaTitle(kind: string): string {
if (kind === "video") return t("wl.mediaVideo");
if (kind === "audio") return t("wl.mediaAudio");
@@ -593,7 +611,6 @@
toast.error(apiErrorMessage(err));
}
}
const pendingCount = $derived(rows.filter((r) => !r.usage).length);
const favCount = $derived(rows.filter((r) => r.favorite).length);
</script>
@@ -604,7 +621,7 @@
.length} 个</span
>{/snippet}
{#snippet actions()}<Button size="sm" onclick={() => (singleOpen = true)}
><Icon name="upload" size={14} />导入工作流</Button
><Icon name="upload-manage" size={14} />导入工作流</Button
>{/snippet}
<div class="mg-layout">
<aside class="mg-side" aria-label="工作流筛选">
@@ -707,7 +724,7 @@
<div class="mg-main">
<div class="mg-tools">
<label class="mg-search workflow-search"
><Icon name="search" size={14} /><input
><Icon name="search-manage" size={14} /><input
bind:this={searchInput}
bind:value={search}
placeholder="搜索名称、文件名、模型…"
@@ -809,12 +826,11 @@
><td><span class="mg-tag {state.tone}">{state.label}</span></td>
<td
><button
class="mg-click"
aria-label={"收藏 " + row.name}
aria-pressed={row.favorite}
onclick={() =>
$favMutation.mutate({ id: row.id, fav: !row.favorite })}
><Icon name="star" size={13} /></button
class="mg-pin"
aria-label={"在创作台置顶 " + row.name}
aria-pressed={pins.includes(row.id)}
onclick={() => pin(row.id)}
><Icon name="pin" size={14} /></button
></td
>
</tr>
@@ -896,6 +912,13 @@
size="sm"
variant="ghost"
onclick={() => openMetaDialog([row])}>+ 标签</Button
><Button
size="sm"
variant="ghost"
loading={$favMutation.isPending}
onclick={() =>
$favMutation.mutate({ id: row.id, fav: !row.favorite })}
>{row.favorite ? "★ 已收藏" : "☆ 收藏"}</Button
>
</div>
</div>
@@ -906,13 +929,10 @@
</p>{:else if full}{#each full.input_schema as input}<div
class="mg-map"
>
<span class="a">{input.nodeId} · {input.label}</span><Icon
name="chevron-right"
size={12}
/><span class="b"
>{input.role ?? input.kind}{input.required
? "(必填)"
: ""}</span
<span class="a"
>{inputNodeLabel(full, input.nodeId, input.label)}</span
><Icon name="arrow-right" size={14} /><span class="b"
>{input.label}{input.required ? "(必填)" : ""}</span
>
</div>{/each}{:else}<Button
size="sm"
@@ -13,10 +13,7 @@
import SafeMedia from "$lib/components/SafeMedia.svelte";
import Button from "$lib/components/ui/Button.svelte";
import ConfirmDialog from "$lib/components/ui/ConfirmDialog.svelte";
import EmptyState from "$lib/components/ui/EmptyState.svelte";
import Icon from "$lib/components/ui/Icon.svelte";
import Modal from "$lib/components/ui/Modal.svelte";
import Skeleton from "$lib/components/ui/Skeleton.svelte";
import { toast } from "$lib/toast";
const client = useQueryClient();
@@ -60,32 +60,6 @@
},
];
const ELSEWHERE: {
href: string;
labelKey: string;
blurbKey: string;
icon: IconName;
}[] = [
{
href: "/models",
labelKey: "shell.navModels",
blurbKey: "settings.linkModelsBlurb",
icon: "assets",
},
{
href: "/connections",
labelKey: "shell.navConnections",
blurbKey: "settings.linkConnectionsBlurb",
icon: "link",
},
{
href: "/agents",
labelKey: "shell.navAgents",
blurbKey: "settings.linkAgentsBlurb",
icon: "sparkle",
},
];
// Old Calliope tab links (/settings?tab=llm …) land on the page that now
// owns that setting instead of a dead tab.
const MOVED_TABS: Record<string, string> = {
@@ -127,24 +101,6 @@
);
const isDirty = $derived(dirtyKeys.length > 0);
const FIELD_SECTION: Record<string, Section> = {
dry_run: "queue",
queue_concurrency: "queue",
queue_poll_interval_sec: "queue",
queue_poll_timeout_sec: "queue",
queue_max_retries: "queue",
agent_max_steps: "agent",
agent_hardening_prompt: "agent",
agent_history_char_budget: "agent",
agent_shell_enabled: "agent",
data_dir: "storage",
assets_dir: "storage",
agent_workspace_dir: "storage",
};
const dirtySections = $derived(
new Set(dirtyKeys.map((k) => FIELD_SECTION[k]).filter(Boolean)),
);
// Mirrors backend Field(ge=..., le=...) limits — validated client-side so
// save never trips a raw 422.
const NUMERIC_LIMITS: Record<
@@ -341,14 +297,6 @@
return s.agent_hardening_prompt ?? "";
}
function selectSection(id: Section) {
goto(`/settings?tab=${id}`, {
replaceState: true,
noScroll: true,
keepFocus: true,
});
}
type NumField = {
key: keyof Settings & string;
labelKey: string;
+3 -20
View File
@@ -7,7 +7,6 @@
apiErrorMessage,
assetUrl,
jobsApi,
playgroundApi,
projects,
workflows,
type Job,
@@ -26,14 +25,7 @@
} from "$lib/jobLabels";
import { createTakeDeleteQueue } from "$lib/components/generate/takeDelete.svelte";
/**
* 生成任务页 (spec-v2 §3.5, HEL-612/654 D 批): one table summing both
* task classes — image and video — from standalone windows, the
* creation flow, and Playground. Filter chips + search; running rows
* carry a 2px progress bar; 重试 is a ghost text op (spec v2 §1.2);
* deleting one task is record-level: 200ms collapse + 5s undo Toast,
* no dialog. The real DELETE only fires after the undo window.
*/
/** Three-column real tasks: source filters, queue list and details. Existing SSE, retry, cancellation and undo-delete behavior is preserved. */
const client = useQueryClient();
const jobsQuery = createQuery({
@@ -123,15 +115,6 @@
return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
}
/** 2px 进度条贴行底 — real progress from the SSE store only. */
function rowProgress(job: Job): number {
if (job.status !== "running") return 0;
const live = progressFor(job.id);
const phase = live?.phase ?? job.phase;
if (phase !== "comfy_running" && phase !== "saving") return 0;
return live?.progress ?? 3;
}
function toneOf(job: Job, base: string): string {
if (base === "ok" && isFileMissing(job)) return "warn";
if (base === "queue") return "";
@@ -210,7 +193,7 @@
>{/each}
</div>{/snippet}
{#snippet actions()}<label class="mg-search task-search"
><Icon name="search" size={14} /><input
><Icon name="search-manage" size={14} /><input
type="search"
bind:value={search}
placeholder="搜索任务…"
@@ -248,7 +231,7 @@
><td
><button class="mg-click" onclick={() => (activeId = job.id)}
><Icon
name={job.kind === "image" ? "image" : "film"}
name={job.kind === "image" ? "image" : "film-manage"}
size={14}
/><span class="mg-name"
><b>{wfName(job)}</b><small
+3
View File
@@ -73,6 +73,9 @@
--manage-segment-option-radius: 7px;
--manage-page-background: var(--bg-0);
--manage-panel-background: var(--bg-1);
--manage-icon-stroke: 1.7;
--manage-pin-radius: 6px;
--manage-pin-size: 24px;
--manage-control-height: 32px;
--manage-control-size: 12.5px;
--manage-control-weight: 500;
@@ -14,7 +14,7 @@
- `routes/library`:使用素材墙,保留真实文件索引、分页、预览、选择、删除确认、存入项目。视频默认暂停,进入预览后也需手动播放。接口只提供图片/视频且没有归属字段,因此音频/未归属筛选明确禁用,项目范围显示全部,不假造归属。
- `routes/settings`:两列分组、四主题预览卡、七种真实语言、队列数值、动效开关、Dry-run、存储目录、固定保存栏;更多队列/目录/智能体选项保留在高级分组。原验证、草稿、放弃修改、离页保护及保存逻辑保留。
- `AppShell` 只增加可选页头插槽;未改导航内容。`ThemeChoices` 的新 tiles 形态仅用于设置,原主题弹层形态保留。`LanguageSwitcher` 保留原下拉形态,并增加设置页分段形态。
- 主题切换按 HEL-726 补 520ms 圆形展开、280ms 颜色回退、减少动效立即切换、连续选择以最后一次为准。仅改变根 token 和主题 store,不重新挂载编辑器。现有按钮在原统一规则中改用可选尺寸/字重 token,默认值保留 B1 最终值,管理页消费样本值。
- 主题切换按 HEL-726 补 520ms 圆形展开、280ms 颜色回退、减少动效立即切换、连续选择以最后一次为准。仅改变根 token 和主题 store,不重新挂载编辑器。现有按钮在原统一规则中改用可选尺寸/字重 token,默认值保留 B1 最终值,管理页消费样本值。Icon 通过可选 stroke token 保留 B1 默认 1.5,仅管理页用原件 1.7,并在既有图标表中补原件的置顶、搜索、上传与映射箭头等路径,旧图标键不改;置顶复用创作台的本地 pin 存储,原后端收藏操作仍保留在详情。输入映射左侧显示真实节点类及字段,右侧显示控件名称。
上述路径除 `static` 外均相对 `calliope-web/`。
+62
View File
@@ -43,6 +43,54 @@ try {
"search empty state",
);
await page.locator(".workflow-search input").fill("");
check(
(await page
.locator(".management-header .icon")
.first()
.evaluate((el) => getComputedStyle(el).strokeWidth)) === "1.7px",
"management icon stroke matches approved 1.7",
);
await page.locator(".mg-side .mg-filter").nth(1).hover();
await page.screenshot({
path: path.join(out, "interaction-filter-hover.png"),
});
await page.route("**/api/workflows/*/check", async (route) => {
await new Promise((resolve) => setTimeout(resolve, 400));
await route.continue();
});
await page
.getByRole("button", { name: "检查节点与模型", exact: true })
.click();
await page.locator(".mg-detail .a-btn.loading").waitFor();
await page.screenshot({
path: path.join(out, "interaction-check-loading.png"),
});
check(
true,
"real node check exposes loading feedback under 400ms transport delay",
);
await page.locator(".mg-detail .a-btn.loading").waitFor({ state: "hidden" });
await page.unroute("**/api/workflows/*/check");
const pinButton = page.locator(".mg-pin").first();
await pinButton.click();
check(
(await pinButton.getAttribute("aria-pressed")) === "true",
"workflow pin is selected",
);
await page.goto(base + "/image", { waitUntil: "networkidle" });
check(
(await page
.locator(".sidebar .icon")
.first()
.evaluate((el) => getComputedStyle(el).strokeWidth)) === "1.5px",
"B1 icon stroke remains 1.5",
);
check(
await page.getByText("置顶工作流", { exact: true }).isVisible(),
"library pin is shared with B1 creation rail",
);
await page.goto(base + "/workflows", { waitUntil: "networkidle" });
await page.locator(".mg-pin").first().click();
await page.getByRole("button", { name: "批量标注", exact: true }).click();
await page
.getByRole("checkbox", { name: "全选当前列表", exact: true })
@@ -212,6 +260,20 @@ try {
),
"rapid theme switching keeps the final choice",
);
const advanced = page.locator(".advanced");
await advanced.locator("summary").click();
check(
await advanced.evaluate((el) => el.open),
"settings advanced controls expand",
);
await page.screenshot({
path: path.join(out, "interaction-settings-expanded.png"),
});
await advanced.locator("summary").click();
check(
!(await advanced.evaluate((el) => el.open)),
"settings advanced controls collapse",
);
// Approved sample, downloaded separately through the CLI; do not modify it.
const sampleFile = path.resolve(
"..",