managarten/scripts
Till JS 56ffcbac39 feat: add Ollama memory optimization, LLM metrics, and chat streaming
Three improvements to the unified LLM infrastructure:

1. Ollama memory optimization (scripts/mac-mini/configure-ollama.sh):
   - OLLAMA_KEEP_ALIVE=5m → models unload after 5min idle (saves 3-16GB RAM)
   - OLLAMA_NUM_PARALLEL=1 → predictable memory usage
   - OLLAMA_MAX_LOADED_MODELS=1 → max 1 model in RAM at a time

2. Request-level metrics in @manacore/shared-llm:
   - LlmRequestMetrics interface (model, latency, tokens, fallback detection)
   - LlmMetricsCollector class with summary stats (for health endpoints)
   - Optional onMetrics callback in LlmModuleOptions
   - Automatic metrics emission in chatMessages() (success + error)

3. Chat streaming (token-by-token SSE):
   - Backend: POST /chat/completions/stream SSE endpoint
   - OllamaService.createStreamingCompletion() via llm.chatStreamMessages()
   - ChatService.createStreamingCompletion() with upfront credit consumption
   - Web: chatApi.createStreamingCompletion() SSE consumer
   - Chat store: sendMessage() now streams tokens into assistant message
   - UI updates reactively as each token arrives

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 09:41:33 +01:00
..
mac-mini feat: add Ollama memory optimization, LLM metrics, and chat streaming 2026-03-24 09:41:33 +01:00
test-data test: implement comprehensive automated testing system with daily CI/CD 2025-12-25 19:12:27 +01:00
test-reporting test: implement comprehensive automated testing system with daily CI/CD 2025-12-25 19:12:27 +01:00
backup-monitoring.sh 📈 feat(monitoring): upgrade to VictoriaMetrics + DuckDB analytics 2026-01-28 12:38:04 +01:00
create-gift-codes.mjs feat(gifts): add gift code creation script and initial codes 2026-02-14 11:23:08 +01:00
deploy-metrics.sh fix(deploy): fix image size measurement in deploy metrics 2026-03-20 21:13:03 +01:00
fix-mixed-imports.mjs Fix wrong type 2025-12-04 23:25:25 +01:00
generate-env.mjs chore: remove presi mobile app, update outdated mobile docs 2026-03-23 13:16:29 +01:00
run-tests-with-coverage.sh test: implement comprehensive automated testing system with daily CI/CD 2025-12-25 19:12:27 +01:00
setup-databases.sh feat(citycorners): add city guide app for Konstanz with full monorepo integration 2026-03-23 10:56:26 +01:00
validate-monorepo.mjs 🔧 chore: enforce monorepo best practices with automated validation 2025-12-25 17:57:00 +01:00