FEAT-nonblocking-backend-io-imporvements #1

Merged
kjannette merged 3 commits from FEAT-nonblocking-backend-io-imporvements into master 2026-08-01 05:43:24 +00:00
3 changed files with 181 additions and 184 deletions
Showing only changes of commit 7b47e46852 - Show all commits

View File

@@ -7,7 +7,7 @@ import { batch } from '../lib/streams.js';
const SELECT_NOTES = 'SELECT id, text, x, y, author, color FROM notes ORDER BY id';
// Postgres caps a statement at 65535 bind parameters; six columns per note
// leaves 10922 as the hard ceiling, so stay well under it.
// leaves 10922 as the hard ceiling.
const INSERT_BATCH_SIZE = 1000;
export const getAllNotes = async () => {
@@ -16,9 +16,8 @@ export const getAllNotes = async () => {
};
/**
* Streams every note as an object-mode Readable. The pooled client is checked
* out for the life of the stream and released once it ends, errors, or is
* destroyed early by a consumer.
* Streams every note as an object-mode Readable. The pooled client is released on end, error, or
* destruction by consumer.
*
* @returns {Promise<import('node:stream').Readable>}
*/

View File

@@ -7,7 +7,6 @@ const client = new VoyageAIClient({
apiKey: process.env.VOYAGEAI_API_KEY,
});
// Well under Voyage's per-request input and token ceilings.
const EMBED_BATCH_SIZE = 128;
/**

View File

@@ -1,6 +1,5 @@
/**
* Structural validation: confirms the LLM output is well-formed
* before it reaches the frontend.
* Structural validation for LLM output
*
* @param {Array<{label: string, noteIds: string[]}>} clusters
* @param {string[]} inputNoteIds - the original note IDs that were sent to the LLM
@@ -62,7 +61,7 @@ const cosineSimilarity = (a, b) => {
};
/**
* Computes a silhouette-style cohesion score for the clustering.
* Computes silhouette-style cohesion score for the clustering.
*
* For each note, measures how much more similar it is to its own cluster
* versus the nearest neighboring cluster. Returns a score in [-1, 1]