fix: bundle chromadb and fix fetch invocation in Electron

- Bundle chromadb into main.js via esbuild instead of externalizing it.
  Obsidian's renderer cannot resolve bare require('chromadb') against a
  plugin-local node_modules. By bundling, the client library is inlined and
  works out of the box with just manifest.json + main.js.

- Remove eager cache initialization from OllamaClient constructor to avoid
  unhandled promise rejections when chromadb/ChromaDB is unavailable.

- Fix 'Failed to execute fetch on Window: Illegal invocation' by wrapping
  the default fetch fallback in an arrow function:
    this.fetchFn = fetchFn ?? ((url, init) => fetch(url, init));
  This preserves the window binding when fetch is called later.

- Update install.sh and README to remove the obsolete node_modules/chromadb
  copy step.

- Update ollama-client-cache tests to reflect that cache initialization is
  no longer eager.
This commit is contained in:
2026-05-19 20:38:50 +02:00
parent 26e178fa96
commit 97cc4ed5fe
8 changed files with 8298 additions and 26 deletions
+14
View File
@@ -0,0 +1,14 @@
services:
chroma:
image: chromadb/chroma:latest
ports:
- "8666:8000"
environment:
- CHROMA_SERVER_HOST=0.0.0.0
- CHROMA_SERVER_HTTP_PORT=8000
volumes:
- chroma_data:/chroma/chroma
restart: unless-stopped
volumes:
chroma_data: