Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix(catalog-sync): guard embeddings prune on length, not truthiness (#633)

Jasnoor Gill1dfd74d320f5
diff --git a/server/src/services/catalog-sync.ts b/server/src/services/catalog-sync.ts
index 62eed362..db3c9587 100644
--- a/server/src/services/catalog-sync.ts
+++ b/server/src/services/catalog-sync.ts
@@ -523,7 +523,12 @@ export function applyCatalog(db: Db, catalog: Catalog): NonNullable<SyncResult['
}
}
- if (catalog.embeddings) {
+ // Embeddings are their own full snapshot. Older catalogs omit this field,
+ // AND catalogs may publish `embeddings: []` while still shipping model
+ // rows — both cases mean "retain the app's bundled embedding baseline
+ // untouched". The JS truthy check on a non-empty array object would
+ // misfire on `[]`, wiping the seeded rows; gate on length instead.
+ if (catalog.embeddings && catalog.embeddings.length > 0) {
const embeddingCandidates = db
.prepare(`
SELECT id, platform, model_id