feat(notes): liens internes, onglet Réseau, living blocks et consentement IA
Some checks failed
CI / Lint, Test & Build (push) Failing after 1m19s
CI / Deploy production (on server) (push) Has been skipped

Rend les liens entre notes visibles et persistants (sync NoteLink au save, auto-save, graphe réseau rafraîchi), ajoute living blocks, Memory Echo, recherche globale, consentement IA explicite et consolide les prototypes design en architectural-grid.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Antigravity
2026-05-24 14:27:29 +00:00
parent 077e665dfc
commit e2672cd2c2
323 changed files with 20670 additions and 42431 deletions

View File

@@ -1,8 +1,11 @@
/**
* Chart Suggestion Service
* Frontend service for calling the AI chart suggestions API
* NOW WITH FAST PARSER - skips AI when possible (< 50ms vs 2 minutes)
*/
import { parseChartData, generateChartSuggestions } from '@/lib/chart/parser'
export interface ChartSuggestion {
type: 'bar' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'radar' | 'funnel' | 'gauge'
title: string
@@ -64,6 +67,7 @@ function setCached(key: string, data: SuggestChartsResponse): void {
/**
* Call the AI chart suggestions API
* FAST PATH: Try regex parser first (< 50ms), only call AI if no data found
* @param request - The request parameters
* @returns Promise with the chart suggestions
*/
@@ -78,7 +82,29 @@ export async function suggestCharts(request: SuggestChartsRequest): Promise<Sugg
return cached
}
console.log('[suggestCharts] CACHE MISS - calling API')
console.log('[suggestCharts] CACHE MISS - trying fast parser first')
// FAST PATH: Try regex parser first - NO AI call needed!
const textToParse = request.selection || request.content || ''
const parsed = parseChartData(textToParse)
if (parsed.hasData && parsed.confidence > 0.3) {
console.log('[suggestCharts] FAST PATH - regex parser found data, skipping AI!')
const suggestions = generateChartSuggestions(parsed.data)
const response: SuggestChartsResponse = {
suggestions,
analyzedText: textToParse.substring(0, 200),
detectedData: `${parsed.data.length} data points found`,
hasData: true,
}
// Cache the fast result
setCached(cacheKey, response)
return response
}
console.log('[suggestCharts] Parser found no good data, calling AI API (slow...)')
try {
const response = await fetch('/api/ai/suggest-charts', {

View File

@@ -96,6 +96,16 @@ export class MemoryEchoService {
* Find meaningful connections between user's notes
*/
async findConnections(userId: string, demoMode: boolean = false): Promise<NoteConnection[]> {
// GDPR AI Consent check — compliance skip if not granted (AC6)
const userSettings = await prisma.userAISettings.findUnique({
where: { userId },
select: { aiProcessingConsent: true },
})
if (!userSettings?.aiProcessingConsent) {
console.log(`[MemoryEchoService] User ${userId} has not given AI consent. Skipping connection generation for compliance.`)
return []
}
// Ensure all notes have embeddings before searching for connections
await this.ensureEmbeddings(userId)