feat: add slides generation tool with multiple slide types
- 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>
This commit is contained in:
18
memento-note/lib/embeddings.ts
Normal file
18
memento-note/lib/embeddings.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user