- Add slides.tool.ts with support for title, bullets, chart, stats, table, cards, timeline, quote, comparison, equation, image, summary slide types - Chart types: bar, horizontal-bar, line, donut, radar - Integrate with agent executor and canvas system - Add multilingual support (en/fr) - Various UI improvements and bug fixes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
19 lines
705 B
TypeScript
19 lines
705 B
TypeScript
import prisma from '@/lib/prisma'
|
|
|
|
/**
|
|
* Upsert a note embedding into the NoteEmbedding table.
|
|
* Uses a single SQL UPSERT to avoid race conditions.
|
|
* The SQL template is fully static — no user data is interpolated into the query string.
|
|
*/
|
|
export async function upsertNoteEmbedding(noteId: string, embedding: number[]): Promise<void> {
|
|
const vecStr = `[${embedding.join(',')}]`
|
|
await prisma.$executeRawUnsafe(
|
|
`INSERT INTO "NoteEmbedding" ("id", "noteId", "embedding", "createdAt", "updatedAt")
|
|
VALUES (gen_random_uuid(), $1, $2::vector, now(), now())
|
|
ON CONFLICT ("noteId")
|
|
DO UPDATE SET "embedding" = EXCLUDED."embedding", "updatedAt" = now()`,
|
|
noteId,
|
|
vecStr
|
|
)
|
|
}
|