## Bug Fixes ### Note Card Actions - Fix broken size change functionality (missing state declaration) - Implement React 19 useOptimistic for instant UI feedback - Add startTransition for non-blocking updates - Ensure smooth animations without page refresh - All note actions now work: pin, archive, color, size, checklist ### Markdown LaTeX Rendering - Add remark-math and rehype-katex plugins - Support inline equations with dollar sign syntax - Support block equations with double dollar sign syntax - Import KaTeX CSS for proper styling - Equations now render correctly instead of showing raw LaTeX ## Technical Details - Replace undefined currentNote references with optimistic state - Add optimistic updates before server actions for instant feedback - Use router.refresh() in transitions for smart cache invalidation - Install remark-math, rehype-katex, and katex packages ## Testing - Build passes successfully with no TypeScript errors - Dev server hot-reloads changes correctly
2.1 KiB
2.1 KiB
Story 3.1: Indexation Vectorielle Automatique
Status: ready-for-dev
Story
As a system, I want to generate and store vector embeddings for every note change, So that the notes are searchable by meaning later.
Acceptance Criteria
- Given a Prisma schema.
- When I run the migration.
- Then the
Notetable has a field to store vectors (Unsupported type for Postgres/pgvector, or Blob/JSON for SQLite). - Given a note creation or update.
- When the note is saved.
- Then an embedding is generated via the AI Provider (
getEmbeddings). - And the embedding is stored in the database asynchronously.
Tasks / Subtasks
- Mise à jour du Schéma Prisma (AC: 1, 2, 3)
- Ajouter un champ
embedding(Bytes ou String pour compatibilité SQLite/Postgres) npx prisma migrate dev
- Ajouter un champ
- Implémentation de la génération d'embeddings (AC: 4, 5, 6)
- Modifier
createNoteetupdateNotedansactions/notes.ts - Appeler
provider.getEmbeddings(content) - Sauvegarder le résultat
- Modifier
- Script de Backfill (Migration de données)
- Créer une action pour générer les embeddings des notes existantes
- Optimisation
- Ne pas régénérer l'embedding si le contenu n'a pas changé
Dev Notes
- Compatibilité DB : Le projet utilise
sqlitepar défaut (dev.db). SQLite ne supporte pas nativement les vecteurs comme pgvector.- Solution : Stocker les vecteurs sous forme de
String(JSON) ouBytesdans SQLite. - Recherche : Pour le MVP local, nous ferons la recherche par similarité cosinus en mémoire (JavaScript) ou via une extension SQLite (comme
sqlite-vss) si possible sans trop de complexité. - Choix BMad : Stockage JSON String pour simplicité maximale et compatibilité. Calcul de similarité en JS (rapide pour < 1000 notes).
- Solution : Stocker les vecteurs sous forme de
- Performance : L'appel
getEmbeddingspeut être lent. Il ne doit pas bloquer l'UI.- Utiliser
waitUntil(Next.js) ou ne pasawaitla promesse d'embedding dans la réponse UI.
- Utiliser