.agents/memory/2026-02-22-dashboard-umap-projection-migration.md

15 lines
1.6 KiB
Markdown

# 2026-02-22 Session Notes
## Dashboard UMAP Projection Migration
Frontend-worker on the umap-perf team received task #5: migrate the embeddings dashboard from client-side UMAP computation to server-side projection fetching. The changes involve two main files and represent a significant architectural shift in how embedding visualizations are handled.
The new flow: instead of fetching raw embedding vectors and running UMAP in the browser, the dashboard now fetches pre-computed 2D/3D coordinates from the daemon via `GET /api/embeddings/projection?dimensions=2|3`. This reduces client-side computation burden and allows the server to cache expensive layout calculations.
Key changes required:
1. **api.ts**: Add `ProjectionNode` and `ProjectionResponse` types, implement `getProjection()` function with polling logic for "computing" status (HTTP 202)
2. **EmbeddingsTab.svelte**: Remove UMAP import and all client-side vector math; rewrite `initGraph()` to fetch projections and map nodes to GraphNode format; rewrite `switchGraphMode()` for 3D; replace `computeRelationsForSelection()` to use async `getSimilarMemories()` API call instead of cosine similarity
Preserved functionality: search/filter, EmbeddingInspector integration, canvas 2D/3D rendering, embeddingsHasMore indicator. Removed: embedding limit controls (server now sends all points), client-side cosine similarity computation, UMAP-related state variables.
Critical consideration: `EmbeddingPoint` type mapping from `ProjectionNode` must be preserved so downstream inspector and canvas components continue working despite vector data no longer being available client-side.