From b0d60f80040081d6a9928a0b78d7d0d3ed287571 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Mon, 2 Jun 2025 19:01:34 +0000 Subject: [PATCH] refactor(llm): update NoteEmbeddingRow structure and add handling in LoadResults class --- apps/client/src/services/froca_updater.ts | 2 +- apps/client/src/services/load_results.ts | 27 +++++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/apps/client/src/services/froca_updater.ts b/apps/client/src/services/froca_updater.ts index d01aa7a73..27d25922a 100644 --- a/apps/client/src/services/froca_updater.ts +++ b/apps/client/src/services/froca_updater.ts @@ -36,7 +36,7 @@ async function processEntityChanges(entityChanges: EntityChange[]) { } else if (ec.entityName === "attachments") { processAttachment(loadResults, ec); } else if (ec.entityName === "blobs" || ec.entityName === "etapi_tokens" || ec.entityName === "note_embeddings") { - // NOOP + // NOOP - these entities don't require frontend processing } else { throw new Error(`Unknown entityName '${ec.entityName}'`); } diff --git a/apps/client/src/services/load_results.ts b/apps/client/src/services/load_results.ts index 3f034a1e2..9762463f6 100644 --- a/apps/client/src/services/load_results.ts +++ b/apps/client/src/services/load_results.ts @@ -44,11 +44,18 @@ interface OptionRow {} interface NoteReorderingRow {} -interface ContentNoteIdToComponentIdRow { +interface NoteEmbeddingRow { + embedId: string; noteId: string; - componentId: string; + providerId: string; + modelId: string; + dimension: number; + version: number; + dateCreated: string; + utcDateCreated: string; + dateModified: string; + utcDateModified: string; } -interface NoteEmbeddingRow {} type EntityRowMappings = { notes: NoteRow; @@ -73,6 +80,7 @@ export default class LoadResults { private contentNoteIdToComponentId: ContentNoteIdToComponentIdRow[]; private optionNames: string[]; private attachmentRows: AttachmentRow[]; + private noteEmbeddingRows: NoteEmbeddingRow[]; constructor(entityChanges: EntityChange[]) { const entities: Record> = {}; @@ -101,6 +109,8 @@ export default class LoadResults { this.optionNames = []; this.attachmentRows = []; + + this.noteEmbeddingRows = []; } getEntityRow(entityName: T, entityId: string): EntityRowMappings[T] { @@ -203,6 +213,14 @@ export default class LoadResults { return this.attachmentRows; } + addNoteEmbedding(embedding: NoteEmbeddingRow) { + this.noteEmbeddingRows.push(embedding); + } + + getNoteEmbeddingRows() { + return this.noteEmbeddingRows; + } + /** * @returns {boolean} true if there are changes which could affect the attributes (including inherited ones) * notably changes in note itself should not have any effect on attributes @@ -220,7 +238,8 @@ export default class LoadResults { this.revisionRows.length === 0 && this.contentNoteIdToComponentId.length === 0 && this.optionNames.length === 0 && - this.attachmentRows.length === 0 + this.attachmentRows.length === 0 && + this.noteEmbeddingRows.length === 0 ); }