feat(insights): fix DBSCAN, Persian embeddings crash, D3 physics layouts, and D3 node not found runtime error
Some checks failed
CI / Lint, Test & Build (push) Failing after 1m7s
CI / Deploy production (on server) (push) Has been skipped

This commit is contained in:
Antigravity
2026-05-24 18:57:33 +00:00
parent e2672cd2c2
commit e881004c77
63 changed files with 5729 additions and 563 deletions

View File

@@ -333,26 +333,27 @@ export class SemanticSearchService {
* SECURITY: Uses parameterized bind params ($1, $2).
* noteId validated via assertSafeId().
*/
async indexNote(noteId: string): Promise<void> {
async indexNote(noteId: string, options?: { force?: boolean }): Promise<void> {
try {
assertSafeId(noteId, 'noteId')
const note = await prisma.note.findUnique({
where: { id: noteId },
select: { content: true, lastAiAnalysis: true }
select: { content: true, title: true, lastAiAnalysis: true, sourceUrl: true }
})
if (!note) throw new Error('Note not found')
if (!note?.content?.trim()) return
const shouldRegenerate = embeddingService.shouldRegenerateEmbedding(
note.content,
null,
note.lastAiAnalysis
note.lastAiAnalysis,
{ force: options?.force, isClip: Boolean(note.sourceUrl?.trim()) },
)
if (!shouldRegenerate) return
const { embedding } = await embeddingService.generateEmbedding(note.content)
const { embedding } = await embeddingService.generateNoteEmbedding(note.title, note.content)
const vecStr = embeddingService.toVectorString(embedding)
await prisma.$queryRawUnsafe(