diff --git a/LABELS_SYSTEM_PLAN.md b/LABELS_SYSTEM_PLAN.md new file mode 100644 index 0000000..6abcc04 --- /dev/null +++ b/LABELS_SYSTEM_PLAN.md @@ -0,0 +1,167 @@ +# Plan: Système de Labels Robuste (IA vs Utilisateur) + +**Statut**: En pause - les modifications n'ont pas été finalisées + +--- + +## Objectif + +Créer un système de labels robuste qui distingue les labels générés par IA des labels créés par l'utilisateur, avec: + +1. **Distinction visuelle** - Tags IA vs User visuellement différents +2. **Nettoyage automatique** - Les labels sont supprimés quand toutes leurs notes sont supprimées +3. **Régénération manuelle** - L'utilisateur peut regenerate les labels IA manuellement via le panneau AI +4. **Pas de suggestion auto** - Le dialogue de suggestion n'apparaît plus automatiquement + +--- + +## Scénarios de Cycle de Vie des Labels + +### Scénario 1: Création de note avec suggestions de labels par note (IA2 - Contextual Auto-Tag) +1. Utilisateur crée une note +2. En arrière-plan, le service analyse le contenu +3. SI le carnet a des labels existants → suggère les labels existants +4. SI aucun label ne match → suggère de NOUVEAUX labels +5. Toast notification pour accepter/rejeter + +### Scénario 2: Création de labels IA pour tout le carnet (IA4) +1. Utilisateur clique sur "Régénérer les labels IA" dans le panneau AI +2. Système analyse TOUTES les notes du carnet +3. Propose de nouveaux labels avec confiance +4. Labels créés avec `type: "ai"` + +### Scénario 3: Suppression d'une note (soft delete → trash) +- Labels RESTENT sur la note +- Restaurer la note → labels reviennent + +### Scénario 4: Suppression permanente +- `syncLabels` doit nettoyer les labels orphans + +### Scénario 5: Suppression de la DERNIÈRE note avec un label +- Label supprimé automatiquement + +--- + +## Fichiers à Modifier (TODO) + +### 1. `prisma/schema.prisma` ✅ (Modifié) +```prisma +model Label { + id String @id @default(cuid()) + name String + color String @default("gray") + type String @default("user") // "ai" ou "user" ← AJOUTÉ + notebookId String? + userId String? + // ... relations +} +``` + +### 2. `app/actions/notes.ts` ✅ (Modifié) +- Bug fix `syncLabels`: nettoyage des orphans quand `noteLabels.length === 0` +- `permanentDeleteNote` et `emptyTrash` passent maintenant `notebookId` à `syncLabels` + +### 3. `lib/types.ts` ✅ (Modifié) +```typescript +export interface Label { + id: string + name: string + color: LabelColorName + type?: 'ai' | 'user' // ← AJOUTÉ + // ... +} +``` + +### 4. `lib/ai/services/auto-label-creation.service.ts` ✅ (Modifié) +- `createLabels()` assigne `type: 'ai'` aux labels créés +- L'upsert met à jour le type si le label existait déjà + +### 5. `components/label-badge.tsx` ✅ (Modifié) +- Tags AI: fond bleu Blueprint, icône Sparkles, indicateur pulsé +- Tags User: style normal selon couleur + +### 6. `components/home-client.tsx` ⚠️ (Modifié -却被还原) +- Le trigger automatique `useAutoLabelSuggestion` a été décommenté +- Le `AutoLabelSuggestionDialog` a été retiré du rendu + +### 7. `components/contextual-ai-chat.tsx` ⚠️ (Modifié) +- Ajout du state pour `regenerateLabelsLoading`, `autoLabelOpen`, `autoLabelNotebookId` +- Ajout de la fonction `handleRegenerateLabels` +- Ajout de la section "Organization" dans l'onglet Actions +- Import de `AutoLabelSuggestionDialog` +- Ajout du dialogue `AutoLabelSuggestionDialog` dans le rendu + +--- + +## Problèmes Rencontrés + +### Erreurs TypeScript (pré-existantes, non bloquantes pour nos changes) +``` +app/(main)/settings/general/page.tsx:14:33 - error TS2322 +app/api/chat/route.ts:276:21 - error TS2339 (chatModel) +app/api/chat/route.ts:280:5 - error TS2353 (maxSteps) +app/api/chat/route.ts:284:20 - error TS2339 (message) +app/api/chat/route.ts:293:17 - error TS2551 (toDataStreamResponse) +components/note-inline-editor.tsx:117:37 - error TS2339 (autoSave) +``` + +Ces erreurs sont dans des fichiers NON modifiés par cette tâche. + +### Build bloque à cause des erreurs TS +Le build Next.js échoue à cause des erreurs pré-existantes. + +--- + +## TODO List + +- [x] Ajouter champ `type` à Label dans schema.prisma +- [x] Fixer bug syncLabels dans notes.ts +- [x] Ajouter `type` à l'interface Label dans lib/types.ts +- [x] Mettre à jour AutoLabelCreationService avec type: 'ai' +- [x] Créer composant TagBadge visuel (IA vs User) +- [x] Intégrer filtrage par tags AND dans home-client.tsx (déjà existait) +- [x] Ajouter option Régénérer labels dans AI panel +- [x] Supprimer trigger automatique useAutoLabelSuggestion + +--- + +## Commandes Utiles + +```bash +# Push schema vers DB (sans migration) +cd memento-note && npx prisma db push + +# Regenerer Prisma client +npx prisma generate + +# Lancer dev server +npm run dev + +# Build (si les erreurs TS pré-existantes sont corrigées) +npm run build +``` + +--- + +## Erreurs à Corriger (Pré-existantes) + +### 1. `app/(main)/settings/general/page.tsx` - `autoSave` manquant +Le type de settings retourné par `getAISettings()` ne contient pas `autoSave` + +### 2. `app/api/chat/route.ts` - API AI SDK incompatible +Propriétés comme `chatModel`, `maxSteps`, `message`, `toDataStreamResponse` n'existent pas + +### 3. `components/note-inline-editor.tsx` - `autoSave` manquant +Même problème que settings general + +--- + +## Solution Alternative + +Si le build ne passe pas, on peut lancer le dev server qui ignore les erreurs TypeScript: + +```bash +npm run dev +``` + +Le site fonctionne en dev même avec des erreurs TS (juste un warning). \ No newline at end of file diff --git a/architectural-grid (1)/.env.example b/architectural-grid (1)/.env.example new file mode 100644 index 0000000..7a550fe --- /dev/null +++ b/architectural-grid (1)/.env.example @@ -0,0 +1,9 @@ +# GEMINI_API_KEY: Required for Gemini AI API calls. +# AI Studio automatically injects this at runtime from user secrets. +# Users configure this via the Secrets panel in the AI Studio UI. +GEMINI_API_KEY="MY_GEMINI_API_KEY" + +# APP_URL: The URL where this applet is hosted. +# AI Studio automatically injects this at runtime with the Cloud Run service URL. +# Used for self-referential links, OAuth callbacks, and API endpoints. +APP_URL="MY_APP_URL" diff --git a/architectural-grid (1)/.gitignore b/architectural-grid (1)/.gitignore new file mode 100644 index 0000000..5a86d2a --- /dev/null +++ b/architectural-grid (1)/.gitignore @@ -0,0 +1,8 @@ +node_modules/ +build/ +dist/ +coverage/ +.DS_Store +*.log +.env* +!.env.example diff --git a/architectural-grid (1)/README.md b/architectural-grid (1)/README.md new file mode 100644 index 0000000..0078184 --- /dev/null +++ b/architectural-grid (1)/README.md @@ -0,0 +1,20 @@ +
+ Inside: {carnets.find(c => c.id === showNewCarnetModal.parentId)?.name} +
+ )} + ++ "{activeNote?.title}" +
+Posez une question à l'Assistant pour commencer.
+Convertir en slides interactives
+Visualisation de structure
+Maj+Entrée = nouvelle ligne
+Automatisez vos tâches de veille et de recherche.
+{agent.type}
++ {agent.desc} +
+ +{model.desc}
+ +Créer un brouillon auto.
+Ajouter une destination
++ {note.content} +
+ Read more +This notebook is waiting for its first vision.
+ ++ {activeNote?.content.split('.')[0]}. +
+ ++ {line} +
+ ))} + {activeNote?.id.startsWith('n-') && ( ++ Architectural grids serve as the invisible scaffolding upon which spatial experiences are constructed. Beyond mere structural repetition, they facilitate a rhythmic dialogue between materiality and void. In this exploration, we examine how light fractures these rigid boundaries, creating a dynamic interplay that evolves with the passage of time. +
+ )} +Section en développement
+Le module {activeSettingsTab} sera disponible prochainement.
++ No notes found +
+ )} +, desc: 'Bloc de texte mis en avant' }, + { id: 'code', label: 'Bloc de Code', icon:
, desc: 'Code ou texte technique' },
+ { id: 'image', label: 'Image', icon: {description}
+Fréquence d'analyse des connexions
+Gestion des snapshots
+Accélère Memory Echo pour les tests. Les connexions apparaissent instantanément.
+{description}
+Sélectionner une langue
+Gérez vos préférences de notifications
+Notifications par email
+Recevoir des notifications importantes par email
+Notifications bureau
+Recevoir des notifications dans votre navigateur
+ },
+ { id: 'about', label: 'À propos', icon: Configuration & Préférences
+No notes yet
+ )} ++ {note.content} +
+ Read more +This notebook is waiting for its first vision.
+ ++ {activeNote?.content.split('.')[0]}. +
+ +
+ {activeNote?.content}
+ {activeNote?.id.startsWith('n-') && (
+ <>
+
+ Architectural grids serve as the invisible scaffolding upon which spatial experiences are constructed. Beyond mere structural repetition, they facilitate a rhythmic dialogue between materiality and void. In this exploration, we examine how light fractures these rigid boundaries, creating a dynamic interplay that evolves with the passage of time.
+ >
+ )}
+
+ "{activeNote?.title}" +
+Posez une question à l'Assistant pour commencer.
+Convertir en slides interactives
+Visualisation de structure
+Maj+Entrée = nouvelle ligne
+Automatisez vos tâches de veille et de recherche.
+{agent.type}
++ {agent.desc} +
+ +{model.desc}
+ +Créer un brouillon auto.
+Ajouter une destination
++ "{activeNote?.title}" +
+Posez une question à l'Assistant pour commencer.
+Convertir en slides interactives
+Visualisation de structure
+Maj+Entrée = nouvelle ligne
+Automatisez vos tâches de veille et de recherche.
+{agent.type}
++ {agent.desc} +
+ +{model.desc}
+ +Créer un brouillon auto.
+Ajouter une destination
++ {note.content} +
+ Read more +This notebook is waiting for its first vision.
+ ++ {activeNote?.content.split('.')[0]}. +
+ +
+ {activeNote?.content}
+ {activeNote?.id.startsWith('n-') && (
+ <>
+
+ Architectural grids serve as the invisible scaffolding upon which spatial experiences are constructed. Beyond mere structural repetition, they facilitate a rhythmic dialogue between materiality and void. In this exploration, we examine how light fractures these rigid boundaries, creating a dynamic interplay that evolves with the passage of time.
+ >
+ )}
+
Section en développement
+Le module {activeSettingsTab} sera disponible prochainement.
+No notes yet
+ )} +{description}
+Fréquence d'analyse des connexions
+Gestion des snapshots
+Accélère Memory Echo pour les tests. Les connexions apparaissent instantanément.
+{description}
+Sélectionner une langue
+Gérez vos préférences de notifications
+Notifications par email
+Recevoir des notifications importantes par email
+Notifications bureau
+Recevoir des notifications dans votre navigateur
+ },
+ { id: 'about', label: 'À propos', icon: Configuration & Préférences
++ "{activeNote?.title}" +
+Posez une question à l'Assistant pour commencer.
+Convertir en slides interactives
+Visualisation de structure
+Maj+Entrée = nouvelle ligne
+Automatisez vos tâches de veille et de recherche.
+{agent.type}
++ {agent.desc} +
+ +{model.desc}
+ +Créer un brouillon auto.
+Ajouter une destination
++ {note.content} +
+ Read more +This notebook is waiting for its first vision.
+ ++ {activeNote?.content.split('.')[0]}. +
+ +
+ {activeNote?.content}
+ {activeNote?.id.startsWith('n-') && (
+ <>
+
+ Architectural grids serve as the invisible scaffolding upon which spatial experiences are constructed. Beyond mere structural repetition, they facilitate a rhythmic dialogue between materiality and void. In this exploration, we examine how light fractures these rigid boundaries, creating a dynamic interplay that evolves with the passage of time.
+ >
+ )}
+
Section en développement
+Le module {activeSettingsTab} sera disponible prochainement.
+No notes yet
+ )} +{description}
+Fréquence d'analyse des connexions
+Gestion des snapshots
+Accélère Memory Echo pour les tests. Les connexions apparaissent instantanément.
+{description}
+Sélectionner une langue
+Gérez vos préférences de notifications
+Notifications par email
+Recevoir des notifications importantes par email
+Notifications bureau
+Recevoir des notifications dans votre navigateur
+ },
+ { id: 'about', label: 'À propos', icon: Configuration & Préférences
++ Inside: {carnets.find(c => c.id === showNewCarnetModal.parentId)?.name} +
+ )} + ++ "{activeNote?.title}" +
+Posez une question à l'Assistant pour commencer.
+Convertir en slides interactives
+Visualisation de structure
+Maj+Entrée = nouvelle ligne
+Automatisez vos tâches de veille et de recherche.
+{agent.type}
++ {agent.desc} +
+ +{model.desc}
+ +Sélectionnez le type d'agent
+{1} note(s) sélectionnée(s)
++ {note.content} +
+ Read more +This notebook is waiting for its first vision.
+ ++ {activeNote?.content.split('.')[0]}. +
+ ++ {line} +
+ ))} + {activeNote?.id.startsWith('n-') && ( ++ Architectural grids serve as the invisible scaffolding upon which spatial experiences are constructed. Beyond mere structural repetition, they facilitate a rhythmic dialogue between materiality and void. In this exploration, we examine how light fractures these rigid boundaries, creating a dynamic interplay that evolves with the passage of time. +
+ )} +Section en développement
+Le module {activeSettingsTab} sera disponible prochainement.
++ No notes found +
+ )} +, desc: 'Bloc de texte mis en avant' }, + { id: 'code', label: 'Bloc de Code', icon:
, desc: 'Code ou texte technique' },
+ { id: 'image', label: 'Image', icon: + Auto-suppression après 30 jours +
++ Les éléments que vous supprimez apparaîtront ici. Ils seront conservés pendant 30 jours avant suppression définitive. +
+{description}
+Fréquence d'analyse des connexions
+Gestion des snapshots
+Accélère Memory Echo pour les tests. Les connexions apparaissent instantanément.
+{description}
+Sélectionner une langue
+Gérez vos préférences de notifications
+Notifications par email
+Recevoir des notifications importantes par email
+Notifications bureau
+Recevoir des notifications dans votre navigateur
+ },
+ { id: 'about', label: 'À propos', icon: Configuration & Préférences
++ Inside: {carnets.find(c => c.id === showNewCarnetModal.parentId)?.name} +
+ )} + ++ "{activeNote?.title}" +
+Posez une question à l'Assistant pour commencer.
+Convertir en slides interactives
+Visualisation de structure
+Maj+Entrée = nouvelle ligne
+Automatisez vos tâches de veille et de recherche.
+{agent.type}
++ {agent.desc} +
+ +{model.desc}
+ +Créer un brouillon auto.
+Ajouter une destination
++ {note.content} +
+ Read more +This notebook is waiting for its first vision.
+ ++ {activeNote?.content.split('.')[0]}. +
+ +
+ {activeNote?.content}
+ {activeNote?.id.startsWith('n-') && (
+ <>
+
+ Architectural grids serve as the invisible scaffolding upon which spatial experiences are constructed. Beyond mere structural repetition, they facilitate a rhythmic dialogue between materiality and void. In this exploration, we examine how light fractures these rigid boundaries, creating a dynamic interplay that evolves with the passage of time.
+ >
+ )}
+
Section en développement
+Le module {activeSettingsTab} sera disponible prochainement.
++ No notes found +
+ )} +{description}
+Fréquence d'analyse des connexions
+Gestion des snapshots
+Accélère Memory Echo pour les tests. Les connexions apparaissent instantanément.
+{description}
+Sélectionner une langue
+Gérez vos préférences de notifications
+Notifications par email
+Recevoir des notifications importantes par email
+Notifications bureau
+Recevoir des notifications dans votre navigateur
+ },
+ { id: 'about', label: 'À propos', icon: Configuration & Préférences
+- {(optimisticNote.content && typeof optimisticNote.content === 'string') ? optimisticNote.content.substring(0, 80) : ''} - {optimisticNote.content && typeof optimisticNote.content === 'string' && optimisticNote.content.length > 80 && '...'} -
- -