feat: bloc Toggle/Section repliable + infrastructure embeddings par fragments
- Nouveau bloc Toggle : sections dépliables dans l'éditeur (slash menu + drag handle) - Transformer un bloc existant en section repliable via le menu d'action - Boutons désactiver (unwrap) et supprimer dans l'en-tête - i18n FR/EN complet - Infrastructure embeddings par fragments (inspiré AppFlowy) - Table NoteEmbeddingChunk + index HNSW - Chunking sémantique (~1000 chars, overlap 200, dedup par hash) - Indexation incrémentale au save (createNote + updateNote + clip) - Queue concurrence 4, retry backoff exponentiel
This commit is contained in:
@@ -8,6 +8,7 @@ import { getAIProvider } from '@/lib/ai/factory'
|
||||
import { parseNote, getHashColor } from '@/lib/utils'
|
||||
import { upsertNoteEmbedding } from '@/lib/embeddings'
|
||||
import { embeddingService } from '@/lib/ai/services/embedding.service'
|
||||
import { chunkIndexingService } from '@/lib/ai/services/chunk-indexing.service'
|
||||
import { syncNoteLinksForNote } from '@/lib/notes/sync-note-links'
|
||||
import { getSystemConfig, getConfigNumber, getConfigBoolean, SEARCH_DEFAULTS } from '@/lib/config'
|
||||
import { contextualAutoTagService } from '@/lib/ai/services/contextual-auto-tag.service'
|
||||
@@ -458,6 +459,12 @@ export async function createNote(data: {
|
||||
console.error('[BG] Embedding generation failed:', e)
|
||||
}
|
||||
|
||||
try {
|
||||
await chunkIndexingService.indexNote(noteId, data.title, content)
|
||||
} catch (e) {
|
||||
console.error('[BG] Chunk indexing failed:', e)
|
||||
}
|
||||
|
||||
// Background task 2: Auto-labeling (only if no user labels and has notebook)
|
||||
if (!hasUserLabels && notebookId) {
|
||||
try {
|
||||
@@ -596,6 +603,12 @@ export async function updateNote(id: string, data: {
|
||||
} catch (e) {
|
||||
console.error('[BG] Embedding regeneration failed:', e);
|
||||
}
|
||||
|
||||
try {
|
||||
await chunkIndexingService.indexNote(noteId, title, content);
|
||||
} catch (e) {
|
||||
console.error('[BG] Chunk indexing failed:', e);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user