feat: reveal all hidden shapes with Shift+H, release SAM3 VRAM on idle and on demand (REQ-191, REQ-192)

This commit is contained in:
asus committed 2026-10-07 11:55:00 +07:00
1 parent f5be7880b0
commit fd608848bf
16 files changed
+290 -20

No files matched your search

+35 -3
View File
@@ -17,6 +17,7 @@ import {
export default function Sidebar({ route, currentProject, theme, onToggleTheme }) {
const [health, setHealth] = useState(null)
const [notice, setNotice] = useState('')
useEffect(() => {
let timer
@@ -28,6 +29,18 @@ export default function Sidebar({ route, currentProject, theme, onToggleTheme })
return () => clearInterval(timer)
}, [])
// REQ-192: free the SAM3 model's VRAM on demand; the 3 s health poll is what
// confirms it, this only flips the badge straight away when it worked.
const releaseSam3 = async () => {
try {
await api.releaseSam3()
setHealth((current) => (current ? { ...current, model_loaded: false } : current))
} catch (exc) {
setNotice(exc.message)
setTimeout(() => setNotice(''), 4000)
}
}
const pId = currentProject?.id || route.projectId || 1
@@ -138,9 +151,28 @@ export default function Sidebar({ route, currentProject, theme, onToggleTheme })
<span className="health-badge">
VRAM: {health.vram_free_gb ? `${health.vram_free_gb.toFixed(1)}GB` : 'N/A'}
</span>
<span className={`health-badge ${health.sam3_ready ? 'ready' : ''}`}>
SAM3: {health.sam3_ready ? 'Ready' : 'Off'}
</span>
{notice && <span className="health-badge">{notice}</span>}
{!health.sam3_ready ? (
<span className="health-badge" title="Not enough free VRAM for SAM3 — free the card first">
SAM3: Off
</span>
) : health.model_loaded ? (
<button
type="button"
className="health-badge ready"
title="SAM3 is in VRAM (~3.9 GB) — click to free it now"
onClick={releaseSam3}
>
SAM3: Loaded
</button>
) : (
<span
className="health-badge ready"
title="SAM3 not in VRAM — it loads on the next use (~12 s)"
>
SAM3: Idle
</span>
)}
</div>
)}