fix: use WASM backend for Chroma embeddings to fix cross-platform issues
Chroma requires client-side embeddings — the server is storage only.
The previous commit incorrectly removed @chroma-core/default-embed.
Uses DefaultEmbeddingFunction({ wasm: true }) which forces the WASM
backend instead of native ONNX binaries. Same model (all-MiniLM-L6-v2),
same embeddings, but works on all platforms without segfaults or
ENOENT errors (#1104, #1105, #1110).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anthropic-ai/claude-agent-sdk": "^0.1.76",
|
"@anthropic-ai/claude-agent-sdk": "^0.1.76",
|
||||||
"@modelcontextprotocol/sdk": "^1.25.1",
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
||||||
|
"@chroma-core/default-embed": "^0.1.9",
|
||||||
"ansi-to-html": "^0.7.2",
|
"ansi-to-html": "^0.7.2",
|
||||||
"chromadb": "^3.2.2",
|
"chromadb": "^3.2.2",
|
||||||
"dompurify": "^3.3.1",
|
"dompurify": "^3.3.1",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+110
-110
File diff suppressed because one or more lines are too long
@@ -189,14 +189,20 @@ export class ChromaSync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Let the Chroma HTTP server handle embeddings server-side.
|
// Use WASM backend to avoid native ONNX binary issues (#1104, #1105, #1110).
|
||||||
// Removes dependency on @chroma-core/default-embed which requires
|
// Same model (all-MiniLM-L6-v2), same embeddings, but runs in WASM —
|
||||||
// onnxruntime + sharp native binaries that fail on many platforms (#1104, #1105, #1110).
|
// no native binary loading, no segfaults, no ENOENT errors.
|
||||||
|
const { DefaultEmbeddingFunction } = await import('@chroma-core/default-embed');
|
||||||
|
const embeddingFunction = new DefaultEmbeddingFunction({ wasm: true });
|
||||||
|
|
||||||
this.collection = await this.chromaClient.getOrCreateCollection({
|
this.collection = await this.chromaClient.getOrCreateCollection({
|
||||||
name: this.collectionName
|
name: this.collectionName,
|
||||||
|
embeddingFunction
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug('CHROMA_SYNC', 'Collection ready', { collection: this.collectionName });
|
logger.debug('CHROMA_SYNC', 'Collection ready', {
|
||||||
|
collection: this.collectionName
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('CHROMA_SYNC', 'Failed to get/create collection', { collection: this.collectionName }, error as Error);
|
logger.error('CHROMA_SYNC', 'Failed to get/create collection', { collection: this.collectionName }, error as Error);
|
||||||
throw new Error(`Collection setup failed: ${error instanceof Error ? error.message : String(error)}`);
|
throw new Error(`Collection setup failed: ${error instanceof Error ? error.message : String(error)}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user