diff --git a/memento-note/app/actions/notes.ts b/memento-note/app/actions/notes.ts index a221394..dd611e1 100644 --- a/memento-note/app/actions/notes.ts +++ b/memento-note/app/actions/notes.ts @@ -8,7 +8,6 @@ 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' @@ -460,6 +459,7 @@ export async function createNote(data: { } try { + const { chunkIndexingService } = await import('@/lib/ai/services/chunk-indexing.service') await chunkIndexingService.indexNote(noteId, data.title, content) } catch (e) { console.error('[BG] Chunk indexing failed:', e) @@ -605,6 +605,7 @@ export async function updateNote(id: string, data: { } try { + const { chunkIndexingService } = await import('@/lib/ai/services/chunk-indexing.service'); await chunkIndexingService.indexNote(noteId, title, content); } catch (e) { console.error('[BG] Chunk indexing failed:', e); diff --git a/memento-note/app/api/clip/save/route.ts b/memento-note/app/api/clip/save/route.ts index c1b1858..21fdc7f 100644 --- a/memento-note/app/api/clip/save/route.ts +++ b/memento-note/app/api/clip/save/route.ts @@ -6,7 +6,6 @@ import { createNotification } from '@/app/actions/notifications' import { buildClipSourceFooter, clipFooterLocaleTag } from '@/lib/clip/extract-article' import { resolveClipLocale, wrapClipArticleHtml, applyRtlToHtmlBlocks } from '@/lib/clip/rtl-content' import { embeddingService } from '@/lib/ai/services/embedding.service' -import { chunkIndexingService } from '@/lib/ai/services/chunk-indexing.service' import { upsertNoteEmbedding } from '@/lib/embeddings' import DOMPurify from 'isomorphic-dompurify' @@ -94,7 +93,10 @@ export async function POST(request: NextRequest) { await upsertNoteEmbedding(note.id, embedding) } - await chunkIndexingService.indexNote(note.id, title || domain, fullContent) + try { + const { chunkIndexingService } = await import('@/lib/ai/services/chunk-indexing.service') + await chunkIndexingService.indexNote(note.id, title || domain, fullContent) + } catch {} } catch (error) { console.error('[clip/save] embedding generation failed:', error) }