diff --git a/tools/sprite-generation/engine/registry.py b/tools/sprite-generation/engine/registry.py index acee8215..ee90de5b 100644 --- a/tools/sprite-generation/engine/registry.py +++ b/tools/sprite-generation/engine/registry.py @@ -890,7 +890,7 @@ class SpriteRegistry: scoring[name] = { "scored": scored, "passed": passed, - "pass_rate": round(passed / scored * 100, 1) if scored else 0.0, + "pass_rate": round(passed / scored, 4) if scored else 0.0, "avg_confidence": round(row["avg_conf"] or 0.0, 3), } diff --git a/tools/sprite-generation/gui/src/pages/DashboardPage.tsx b/tools/sprite-generation/gui/src/pages/DashboardPage.tsx index 0892821e..2b5826c5 100644 --- a/tools/sprite-generation/gui/src/pages/DashboardPage.tsx +++ b/tools/sprite-generation/gui/src/pages/DashboardPage.tsx @@ -476,6 +476,38 @@ export function DashboardPage(): ReactNode { }) }, []) + // Restore running state on mount by checking if server has an active pipeline process + const startStatusPoll = useCallback((): (() => void) => { + const poll = setInterval((): void => { + fetchPipelineStatus() + .then((st) => { + if (!st.running) { + clearInterval(poll) + setRunning(false) + load() + } + }) + .catch(() => { + clearInterval(poll) + setRunning(false) + }) + }, 3000) + return (): void => clearInterval(poll) + }, [load]) + + useEffect((): (() => void) => { + let cancel: (() => void) | null = null + fetchPipelineStatus() + .then((st) => { + if (st.running) { + setRunning(true) + cancel = startStatusPoll() + } + }) + .catch(() => { /* server not yet reachable */ }) + return (): void => { cancel?.() } + }, [startStatusPoll]) + useEffect((): (() => void) => { load() const interval = setInterval(load, 5000) @@ -502,20 +534,7 @@ export function DashboardPage(): ReactNode { setRunning(false) return } - const poll = setInterval((): void => { - fetchPipelineStatus() - .then((st) => { - if (!st.running) { - clearInterval(poll) - setRunning(false) - load() - } - }) - .catch(() => { - clearInterval(poll) - setRunning(false) - }) - }, 3000) + startStatusPoll() } catch (e: unknown) { alert(`Pipeline run failed: ${e instanceof Error ? e.message : String(e)}`) setRunning(false) diff --git a/tools/sprite-generation/spritegen.db-shm b/tools/sprite-generation/spritegen.db-shm index e7186dc0..89af6565 100644 Binary files a/tools/sprite-generation/spritegen.db-shm and b/tools/sprite-generation/spritegen.db-shm differ diff --git a/tools/sprite-generation/spritegen.db-wal b/tools/sprite-generation/spritegen.db-wal index f5638cd1..964b84ff 100644 Binary files a/tools/sprite-generation/spritegen.db-wal and b/tools/sprite-generation/spritegen.db-wal differ