feat: add unit tests, Docker polish, and workbench UX improvements

Unit tests: Consumer class (7), recursive-splitter (10), parseJsonResponse (11) — 28 total.
Docker: add 5 commented LLM provider services, dev compose override, .env.example.
Workbench: chat persistence, error boundary, disconnect banner, prompts error handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
elpresidank 2026-04-07 03:51:29 -05:00
parent c7eefee607
commit 72870a7e2e
17 changed files with 718 additions and 33 deletions

View file

@ -1,10 +1,24 @@
# LLM API Keys
# LLM Provider API Keys (set the one matching your active text-completion service)
OPENAI_TOKEN=
OPENAI_BASE_URL=
CLAUDE_KEY=
AZURE_TOKEN=
AZURE_ENDPOINT=
AZURE_MODEL=gpt-4o
AZURE_API_VERSION=2024-02-15-preview
OLLAMA_MODEL=gemma3:4b
OPENAI_COMPAT_URL=http://localhost:1234/v1
OPENAI_COMPAT_MODEL=default
OPENAI_COMPAT_KEY=
MISTRAL_TOKEN=
MISTRAL_MODEL=ministral-8b-latest
# Gateway
GATEWAY_SECRET=
GATEWAY_PORT=8088
GATEWAY_SECRET=
# Workbench
WORKBENCH_PORT=3001
# Grafana
GF_SECURITY_ADMIN_PASSWORD=admin

View file

@ -29,6 +29,19 @@ services:
- ./loki/loki-config.yml:/etc/loki/local-config.yaml
- loki-data:/tmp/loki
# Override text-completion to use Ollama (no API key needed for local dev)
text-completion:
command: ["node", "entrypoints/text-completion-ollama.mjs"]
environment:
- NATS_URL=nats://nats:4222
- OLLAMA_URL=http://ollama:11434
- OLLAMA_MODEL=${OLLAMA_MODEL:-gemma3:4b}
depends_on:
nats:
condition: service_healthy
ollama:
condition: service_started
# NATS CLI tools for debugging
nats-cli:
image: natsio/nats-box:latest

View file

@ -469,3 +469,81 @@ services:
networks:
- trustgraph
restart: unless-stopped
# ---------------------------------------------------------------------------
# Alternative LLM Providers (uncomment one to use instead of text-completion)
# ---------------------------------------------------------------------------
# text-completion-ollama:
# image: trustgraph-ts:local
# command: ["node", "entrypoints/text-completion-ollama.mjs"]
# environment:
# - NATS_URL=nats://nats:4222
# - OLLAMA_URL=http://ollama:11434
# - OLLAMA_MODEL=${OLLAMA_MODEL:-gemma3:4b}
# depends_on:
# nats:
# condition: service_healthy
# ollama:
# condition: service_started
# networks:
# - trustgraph
# restart: unless-stopped
# text-completion-claude:
# image: trustgraph-ts:local
# command: ["node", "entrypoints/text-completion-claude.mjs"]
# environment:
# - NATS_URL=nats://nats:4222
# - CLAUDE_KEY=${CLAUDE_KEY:-}
# depends_on:
# nats:
# condition: service_healthy
# networks:
# - trustgraph
# restart: unless-stopped
# text-completion-azure-openai:
# image: trustgraph-ts:local
# command: ["node", "entrypoints/text-completion-azure-openai.mjs"]
# environment:
# - NATS_URL=nats://nats:4222
# - AZURE_TOKEN=${AZURE_TOKEN:-}
# - AZURE_ENDPOINT=${AZURE_ENDPOINT:-}
# - AZURE_MODEL=${AZURE_MODEL:-gpt-4o}
# - AZURE_API_VERSION=${AZURE_API_VERSION:-2024-02-15-preview}
# depends_on:
# nats:
# condition: service_healthy
# networks:
# - trustgraph
# restart: unless-stopped
# text-completion-openai-compatible:
# image: trustgraph-ts:local
# command: ["node", "entrypoints/text-completion-openai-compatible.mjs"]
# environment:
# - NATS_URL=nats://nats:4222
# - OPENAI_COMPAT_URL=${OPENAI_COMPAT_URL:-http://localhost:1234/v1}
# - OPENAI_COMPAT_MODEL=${OPENAI_COMPAT_MODEL:-default}
# - OPENAI_COMPAT_KEY=${OPENAI_COMPAT_KEY:-}
# depends_on:
# nats:
# condition: service_healthy
# networks:
# - trustgraph
# restart: unless-stopped
# text-completion-mistral:
# image: trustgraph-ts:local
# command: ["node", "entrypoints/text-completion-mistral.mjs"]
# environment:
# - NATS_URL=nats://nats:4222
# - MISTRAL_TOKEN=${MISTRAL_TOKEN:-}
# - MISTRAL_MODEL=${MISTRAL_MODEL:-ministral-8b-latest}
# depends_on:
# nats:
# condition: service_healthy
# networks:
# - trustgraph
# restart: unless-stopped