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

@@ -0,0 +1,53 @@
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function main() {
const userId = "dev-user-id" // we will grab the first user
const user = await prisma.user.findFirst()
if (!user) {
console.log("No user found")
return
}
console.log(`Testing for user: ${user.email} (${user.id})`)
const rows = await prisma.$queryRawUnsafe<Array<{ noteId: string; embedding: string }>>(
`SELECT ne."noteId", ne."embedding"::text AS "embedding"
FROM "NoteEmbedding" ne
INNER JOIN "Note" n ON n.id = ne."noteId"
WHERE n."userId" = $1
AND n."trashedAt" IS NULL
AND ne."embedding" IS NOT NULL`,
user.id
)
console.log(`Fetched ${rows.length} embedding rows`)
let success = 0
let fail = 0
rows.forEach((row, i) => {
try {
const parsed = JSON.parse(row.embedding)
if (Array.isArray(parsed)) {
success++
if (i === 0) {
console.log(`Example vector size: ${parsed.length}, First few values: ${parsed.slice(0, 5)}`)
}
} else {
fail++
}
} catch (e) {
fail++
if (fail === 1) {
console.error("Failed example text:", row.embedding.slice(0, 100))
console.error(e)
}
}
})
console.log(`Parsing results: Success=${success}, Fail=${fail}`)
}
main().catch(console.error).finally(() => prisma.$disconnect())