From bfcf542e599c567bb2435a160c2df5db60140d03 Mon Sep 17 00:00:00 2001 From: leefer Date: Thu, 22 Oct 2026 02:16:48 +0800 Subject: [PATCH] refactor(HEL-752): remove unused locals while preserving evaluation and props Co-authored-by: multica-agent --- .../src/lib/components/OmniComposer.svelte | 2 +- .../lib/components/WorkflowTestDialog.svelte | 4 +-- .../src/lib/components/desk/Artboard.svelte | 6 ----- .../src/lib/components/desk/StudioDesk.svelte | 26 ++----------------- .../lib/components/desk/TaskModeRail.svelte | 4 --- .../lib/components/desk/WorkflowBay.svelte | 1 - .../lib/components/generate/Composer.svelte | 1 - .../lib/components/generate/Inspector.svelte | 1 - .../src/lib/components/shell/AppShell.svelte | 9 ------- .../src/lib/components/shell/ShellPop.svelte | 6 +++-- .../components/video/JobInputsDrawer.svelte | 2 +- .../video/VideoEditWorkspace.svelte | 3 +-- .../lib/shot/components/ShotInspector.svelte | 6 ++--- .../lib/shot/components/TimelineStrip.svelte | 4 --- calliope-web/src/routes/agents/+page.svelte | 20 -------------- .../src/routes/build-scene/+page.svelte | 1 - .../src/routes/canvas/[id]/+page.svelte | 9 +++---- .../src/routes/workbench/[id]/+page.svelte | 2 -- 18 files changed, 17 insertions(+), 90 deletions(-) diff --git a/calliope-web/src/lib/components/OmniComposer.svelte b/calliope-web/src/lib/components/OmniComposer.svelte index 930d0b6b..d5e6eabe 100644 --- a/calliope-web/src/lib/components/OmniComposer.svelte +++ b/calliope-web/src/lib/components/OmniComposer.svelte @@ -18,7 +18,7 @@ import { createUploadManager } from '$lib/comfy/useUpload.svelte'; import { normalizeInputRole } from '$lib/comfy/parser'; import type { AssetOption } from '$lib/assetPicker'; - import { assetUrl } from '$lib/api'; + import '$lib/api'; import Icon from '$lib/components/ui/Icon.svelte'; import { t } from '$lib/i18n.svelte'; import PillSelect from './omni/PillSelect.svelte'; diff --git a/calliope-web/src/lib/components/WorkflowTestDialog.svelte b/calliope-web/src/lib/components/WorkflowTestDialog.svelte index 5d9f0385..ab616a95 100644 --- a/calliope-web/src/lib/components/WorkflowTestDialog.svelte +++ b/calliope-web/src/lib/components/WorkflowTestDialog.svelte @@ -48,7 +48,7 @@ onchanged, }: Props = $props(); - const client = useQueryClient(); + useQueryClient(); let endpointId = $state(''); let values = $state>({}); @@ -146,7 +146,7 @@ if (stageLog[stageLog.length - 1] !== line) stageLog = [...stageLog, line]; }); $effect(() => { - stageLog.length; + void stageLog.length; if (logBox) logBox.scrollTop = logBox.scrollHeight; }); diff --git a/calliope-web/src/lib/components/desk/Artboard.svelte b/calliope-web/src/lib/components/desk/Artboard.svelte index 69756981..2f81e319 100644 --- a/calliope-web/src/lib/components/desk/Artboard.svelte +++ b/calliope-web/src/lib/components/desk/Artboard.svelte @@ -71,13 +71,8 @@ job, wf, nowMs, - open, - inactive, canSendToSlot, - crossfade, videoEl = $bindable(null), - params, - onClose, onReuse, onRetry, onCancel, @@ -119,7 +114,6 @@ const output = $derived( outputs[Math.min(outIndex, outputs.length - 1)] ?? null, ); - const allOutputs = $derived(job && st?.tone === 'ok' ? job.output_paths : []); const video = $derived(!!job && !!output && isVideoOutput(job, output)); const wfDeleted = $derived(!!job && job.workflow_id == null); const prompt = $derived(job ? promptOf(job, wf) : ''); diff --git a/calliope-web/src/lib/components/desk/StudioDesk.svelte b/calliope-web/src/lib/components/desk/StudioDesk.svelte index 7758fbcf..956b74cf 100644 --- a/calliope-web/src/lib/components/desk/StudioDesk.svelte +++ b/calliope-web/src/lib/components/desk/StudioDesk.svelte @@ -8,7 +8,7 @@ import { SvelteMap, SvelteSet } from 'svelte/reactivity'; import { page } from '$app/state'; import { goto } from '$app/navigation'; - import Icon from '$lib/components/ui/Icon.svelte'; + import '$lib/components/ui/Icon.svelte'; import Modal from '$lib/components/ui/Modal.svelte'; import AppShell from '$lib/components/shell/AppShell.svelte'; import Composer from '$lib/components/generate/Composer.svelte'; @@ -39,7 +39,7 @@ workbenchCtxOf, type FeedFilter, } from '$lib/components/generate/takes'; - import InputRequirementBadge from './InputRequirementBadge.svelte'; + import './InputRequirementBadge.svelte'; import WorkflowBay from './WorkflowBay.svelte'; import DeskWorkflowRail from './DeskWorkflowRail.svelte'; import { @@ -322,15 +322,6 @@ } }); - async function toggleFavorite(id: number, fav: boolean) { - try { - await workflows.update(id, { favorite: fav }); - await client.invalidateQueries({ queryKey: ['workflows-meta'] }); - await client.invalidateQueries({ queryKey: ['workflows'] }); - } catch (err) { - toast.error(apiErrorMessage(err)); - } - } // ------------------------------------------------------------------ // Form state @@ -724,8 +715,6 @@ sentTimer = setTimeout(() => (sent = false), 900); // C 批审核:从「参数」页提交后自动切到「结果」页,进行中进度可见。 tab = 'result'; - if (wide) inspOff = false; - else if (!narrow) inspOpen = true; await client.invalidateQueries({ queryKey: ['playground-jobs'] }); await client.invalidateQueries({ queryKey: ['jobs'] }); // 最近使用由后端在入队时记录 (queue/manager);这里只刷新轻量列表。 @@ -747,8 +736,6 @@ let historyJobId = $state(null); let busyId = $state(null); let tab = $state<'result' | 'params'>('result'); - let inspOff = $state(false); - let inspOpen = $state(false); let wide = $state(true); let narrow = $state(false); let crossfade = $state(false); @@ -807,7 +794,6 @@ tab = 'result'; crossfade = via === 'pointer'; if (via === 'pointer') { - if (!wide) inspOpen = true; void tick().then(() => feed?.slideFrom(from)); } else { feed?.scrollToJob(job.id); @@ -1111,14 +1097,6 @@ // 键盘 (§四.8): Ctrl/⌘+Enter 生成 · / 聚焦搜索/提示词 · ↑↓/J/K 切换 // Ctrl/⌘+Enter 仅在创作输入区提交;Esc 退出选工具。媒体与记录使用显式控件。 // ------------------------------------------------------------------ - function typing(target: EventTarget | null): boolean { - const el = target as HTMLElement | null; - return ( - !!el && - (el.isContentEditable || - ['INPUT', 'TEXTAREA', 'SELECT'].includes(el.tagName)) - ); - } function inLayer(target: EventTarget | null): boolean { const el = target instanceof Element ? target : null; diff --git a/calliope-web/src/lib/components/desk/TaskModeRail.svelte b/calliope-web/src/lib/components/desk/TaskModeRail.svelte index eb52b8d8..35dc443b 100644 --- a/calliope-web/src/lib/components/desk/TaskModeRail.svelte +++ b/calliope-web/src/lib/components/desk/TaskModeRail.svelte @@ -18,10 +18,6 @@ let { kind, metas, active, onSelect, onPickWorkflow }: Props = $props(); - interface ModeEntry { - usage: WorkflowUsage; - count: number; - } const modes = $derived.by(() => { const counts = new Map(); for (const m of metas) { diff --git a/calliope-web/src/lib/components/desk/WorkflowBay.svelte b/calliope-web/src/lib/components/desk/WorkflowBay.svelte index d00d5193..e2dc7e2a 100644 --- a/calliope-web/src/lib/components/desk/WorkflowBay.svelte +++ b/calliope-web/src/lib/components/desk/WorkflowBay.svelte @@ -26,7 +26,6 @@ pendingCount, selectedId, activeId = $bindable(null), - endpoints, onPick, onClose, catalogue = false, diff --git a/calliope-web/src/lib/components/generate/Composer.svelte b/calliope-web/src/lib/components/generate/Composer.svelte index 9f8924e8..7e527f5c 100644 --- a/calliope-web/src/lib/components/generate/Composer.svelte +++ b/calliope-web/src/lib/components/generate/Composer.svelte @@ -63,7 +63,6 @@ slotBusy = $bindable(false), promptEl = $bindable(null), onSet, - onOpenBay, onPickEndpoint, onSubmit, onReveal, diff --git a/calliope-web/src/lib/components/generate/Inspector.svelte b/calliope-web/src/lib/components/generate/Inspector.svelte index 5bfd2509..d42e0017 100644 --- a/calliope-web/src/lib/components/generate/Inspector.svelte +++ b/calliope-web/src/lib/components/generate/Inspector.svelte @@ -62,7 +62,6 @@ open, inactive, canSendToSlot, - crossfade, videoEl = $bindable(null), params, onClose, diff --git a/calliope-web/src/lib/components/shell/AppShell.svelte b/calliope-web/src/lib/components/shell/AppShell.svelte index 69ea8105..3aca1632 100644 --- a/calliope-web/src/lib/components/shell/AppShell.svelte +++ b/calliope-web/src/lib/components/shell/AppShell.svelte @@ -62,10 +62,6 @@ (j) => j.kind === "image" || j.kind === "video", ), ); - const activeJobs = $derived( - genJobs.filter((j) => j.status === "pending" || j.status === "running") - .length, - ); // The ACTIVE ComfyUI connection (HEL-611). Its status dot comes from a // real server-side probe (GET /system_stats from the workbench server, @@ -115,11 +111,6 @@ return $probeQuery.data?.ok ? "ok" : "fail"; }); const endpointName = $derived(activeEndpoint?.name?.trim() || "ComfyUI"); - const latencyMs = $derived( - probeState === "ok" && $probeQuery.data?.elapsed_ms != null - ? Math.round($probeQuery.data.elapsed_ms) - : null, - ); const connDetail = $derived.by(() => { if (probeState === "unset") return t("shell.comfyUnset"); const state = t(`shell.comfy_${probeState}`, { name: endpointName }); diff --git a/calliope-web/src/lib/components/shell/ShellPop.svelte b/calliope-web/src/lib/components/shell/ShellPop.svelte index 86a180bd..3e623730 100644 --- a/calliope-web/src/lib/components/shell/ShellPop.svelte +++ b/calliope-web/src/lib/components/shell/ShellPop.svelte @@ -103,7 +103,8 @@ return Number.isFinite(ms) ? ms : fallback; } - function popIn(_node: Element) { + function popIn(node: Element) { + void node; const reduced = document.documentElement.dataset.reduce === '1'; const sheet = window.matchMedia(SHEET_QUERY).matches; if (reduced) { @@ -123,7 +124,8 @@ }; } - function fadeScrim(_node: Element) { + function fadeScrim(node: Element) { + void node; return { duration: cssMs('--d-pop', 180), css: (t: number) => `opacity: ${t}` }; } diff --git a/calliope-web/src/lib/components/video/JobInputsDrawer.svelte b/calliope-web/src/lib/components/video/JobInputsDrawer.svelte index 1ac02c06..84651218 100644 --- a/calliope-web/src/lib/components/video/JobInputsDrawer.svelte +++ b/calliope-web/src/lib/components/video/JobInputsDrawer.svelte @@ -11,7 +11,7 @@ import Button from '$lib/components/ui/Button.svelte'; import Icon from '$lib/components/ui/Icon.svelte'; import Modal from '$lib/components/ui/Modal.svelte'; - import SafeMedia from '$lib/components/SafeMedia.svelte'; + import '$lib/components/SafeMedia.svelte'; import { assetUrl } from '$lib/api'; import { t } from '$lib/i18n.svelte'; diff --git a/calliope-web/src/lib/components/video/VideoEditWorkspace.svelte b/calliope-web/src/lib/components/video/VideoEditWorkspace.svelte index f09cb214..186ea1bc 100644 --- a/calliope-web/src/lib/components/video/VideoEditWorkspace.svelte +++ b/calliope-web/src/lib/components/video/VideoEditWorkspace.svelte @@ -11,7 +11,7 @@ import ClipMonitor from './ClipMonitor.svelte'; import ClipSourceModal from './ClipSourceModal.svelte'; import JobInputsDrawer from './JobInputsDrawer.svelte'; - import PromptPreviewModal from './PromptPreviewModal.svelte'; + import './PromptPreviewModal.svelte'; import SceneFilmstrip, { type FilmstripClip } from './SceneFilmstrip.svelte'; import SceneScriptDrawer from './SceneScriptDrawer.svelte'; import { t } from '$lib/i18n.svelte'; @@ -87,7 +87,6 @@ import { t } from '$lib/i18n.svelte'; } let { - scenes, filmClips, selectedClip, selectedClipId, diff --git a/calliope-web/src/lib/shot/components/ShotInspector.svelte b/calliope-web/src/lib/shot/components/ShotInspector.svelte index f97a0ee7..bcbb634a 100644 --- a/calliope-web/src/lib/shot/components/ShotInspector.svelte +++ b/calliope-web/src/lib/shot/components/ShotInspector.svelte @@ -5,8 +5,8 @@ * values feed the viewport's shot solver. */ import { shotStore } from '$lib/shot/shotStore.svelte'; - import { JOINT_CONFIGS, getDOF, setDOF, type JointConfig } from '$lib/shot/helpers/jointConfig'; - import { readPosture, clonePosture, type Posture } from '$lib/shot/helpers/posture'; + import { JOINT_CONFIGS, type JointConfig } from '$lib/shot/helpers/jointConfig'; + import '$lib/shot/helpers/posture'; import type { ShotParams } from '$lib/shot/calibration/shotSolver'; import { SHOT_SIZE_OPTIONS, ANGLE_OPTIONS, ELEVATION_OPTIONS } from '$lib/shot/calibration/shotAxes'; import { COMPOSITION_PRESETS } from '$lib/shot/calibration/compositionPresets'; @@ -23,7 +23,7 @@ // reference editor used; the viewport applies it with writePosture. let jointsOpen = $state(true); - function dofValue(cfg: JointConfig, figure: any, dofIndex: number): number { + function dofValue(cfg: JointConfig, figure: { posture?: unknown } | null, dofIndex: number): number { const joint = figure?.posture ? figure : figure; // DOF read from posture data below void joint; // We don't have a live mannequin here — read from the stored posture diff --git a/calliope-web/src/lib/shot/components/TimelineStrip.svelte b/calliope-web/src/lib/shot/components/TimelineStrip.svelte index a896ee47..f09a3a48 100644 --- a/calliope-web/src/lib/shot/components/TimelineStrip.svelte +++ b/calliope-web/src/lib/shot/components/TimelineStrip.svelte @@ -63,10 +63,6 @@ shotStore.addKeyframe(selectedObject.id, elapsed); } - function commitStagedKeyframe() { - if (!selectedObject) return; - shotStore.commitLiveKeyframe(selectedObject.id); - } function deleteSelectedKeyframe() { if (!selectedObject || !selectedKeyframeId) return; diff --git a/calliope-web/src/routes/agents/+page.svelte b/calliope-web/src/routes/agents/+page.svelte index 6dc4db8f..6e7c3457 100644 --- a/calliope-web/src/routes/agents/+page.svelte +++ b/calliope-web/src/routes/agents/+page.svelte @@ -704,15 +704,6 @@ return label === key ? dir : label; } - function formatUpdatedAt(ts: number | null): string { - if (!ts) return ''; - return new Date(ts * 1000).toLocaleString([], { - month: '2-digit', - day: '2-digit', - hour: '2-digit', - minute: '2-digit', - }); - } /** SQLite CURRENT_TIMESTAMP ships as "YYYY-MM-DD HH:MM:SS" in UTC — * parse it as such and render in the viewer's local timezone. */ @@ -740,14 +731,7 @@ : '', ); - function avatarStyle(n: number): string { - return `var(--avatar-${Math.min(Math.max(n, 1), 5)})`; - } - // HEL-680 灰阶头像:1–2 亮阶配深字,3–5 暗阶配浅字,按阶数决定。 - function avatarLight(n: number | undefined): boolean { - return Math.min(Math.max(n ?? 1, 1), 5) <= 2; - } // Reference agent interface: all task actions continue through existing APIs. let agentSearch = $state(''), skillSearch = $state(''); @@ -1115,10 +1099,6 @@ ? $sessionQuery.data.project_id : currentPreference.project, ); - const projectName = $derived( - ($linkableProjectsQuery.data ?? []).find((p) => p.id === sessionProject) - ?.title ?? '不关联项目', - ); function useInspiration() { draft = suggestions[0]?.prompt ?? diff --git a/calliope-web/src/routes/build-scene/+page.svelte b/calliope-web/src/routes/build-scene/+page.svelte index 567ceecf..b282ba53 100644 --- a/calliope-web/src/routes/build-scene/+page.svelte +++ b/calliope-web/src/routes/build-scene/+page.svelte @@ -7,7 +7,6 @@ import AgentComposer from '$lib/components/agent/AgentComposer.svelte'; import { agentApi, - playgroundApi, workflows, type AgentMessage, type AgentPlan, diff --git a/calliope-web/src/routes/canvas/[id]/+page.svelte b/calliope-web/src/routes/canvas/[id]/+page.svelte index f7bcf613..8cec3c77 100644 --- a/calliope-web/src/routes/canvas/[id]/+page.svelte +++ b/calliope-web/src/routes/canvas/[id]/+page.svelte @@ -40,7 +40,6 @@ type AgentTask, type Character, type Item, - type Job, type Location, type Scene, } from '$lib/api'; @@ -67,7 +66,7 @@ }); const canvas = $derived($canvasQuery.data?.canvas ?? null); - const canvasNodes = $derived($canvasQuery.data?.nodes ?? []); + type CanvasNode = import('$lib/api').CanvasNode; const projectId = $derived(canvas?.project_id ?? null); const assetsQuery = createQuery( @@ -87,7 +86,7 @@ ); function mediaFor( - node: (typeof canvasNodes)[number], + node: CanvasNode, characters: Character[], locations: Location[], items: Item[], @@ -154,7 +153,6 @@ // ---- graph sync ---------------------------------------------------------- let syncVersion = $state(0); - let loadedGraphAt = $state(0); // While a drag is active the persisted-graph effect must NOT rebuild: any // SSE-driven refetch (job.started, canvas.updated from another tab, …) // would replace `nodes` with stale DB positions mid-drag and snap the @@ -172,11 +170,10 @@ rebuildPending = false; const graph = $canvasQuery.data; if (!graph) { - loadedGraphAt = 0; nodes = []; return; } - loadedGraphAt = Date.now(); + Date.now(); const characters = $assetsQuery.data?.characters ?? []; const locations = $assetsQuery.data?.locations ?? []; const items = $assetsQuery.data?.items ?? []; diff --git a/calliope-web/src/routes/workbench/[id]/+page.svelte b/calliope-web/src/routes/workbench/[id]/+page.svelte index 96fd610f..e2983777 100644 --- a/calliope-web/src/routes/workbench/[id]/+page.svelte +++ b/calliope-web/src/routes/workbench/[id]/+page.svelte @@ -12,7 +12,6 @@ jobsApi, settings, workbenchApi, - type WorkbenchStage, type WorkbenchStageKey, } from '$lib/api'; import { connectEvents } from '$lib/events'; @@ -72,7 +71,6 @@ const overview = $derived($overviewQuery.data); const stages = $derived(overview?.stages ?? []); - const anyRunning = $derived(stages.some((s) => s.status === 'running')); // ?stage= selects the open stage; default = first not-confirmed one. const urlStage = $derived(