fix: sanitize ChromaDB URL and update docker-compose CORS config

- src/semantic-cache.ts: Add robust URL sanitization in initialize().
  Trim whitespace and reject malformed URLs (e.g. empty host like
  'http://:8666') before passing to ChromaClient.

- src/main.ts: Validate ChromaDB URL in the settings tab onChange.
  Fall back to 'http://localhost:8000' if the value is empty or lacks
  '://'.

- docker-compose.yml: Add CHROMA_SERVER_CORS_ALLOW_ORIGINS=["*"] to
  allow cross-origin requests from Obsidian's app://obsidian.md origin.
This commit is contained in:
2026-05-19 21:59:35 +02:00
parent 6c438f7a4d
commit 1ccd637149
4 changed files with 13 additions and 5 deletions
+2 -1
View File
@@ -2,10 +2,11 @@ services:
chroma:
image: chromadb/chroma:latest
ports:
- "8666:8000"
- '8666:8000'
environment:
- CHROMA_SERVER_HOST=0.0.0.0
- CHROMA_SERVER_HTTP_PORT=8000
- CHROMA_SERVER_CORS_ALLOW_ORIGINS=["*"]
volumes:
- chroma_data:/chroma/chroma
restart: unless-stopped