managarten/apps/chat/apps/backend
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
..
src feat: add Ollama memory optimization, LLM metrics, and chat streaming 2026-03-24 09:41:33 +01:00
.dockerignore refactor: restructure 2025-11-26 03:03:24 +01:00
.env.docker refactor: restructure 2025-11-26 03:03:24 +01:00
.env.example ♻️ refactor(chat): simplify chat service and update seed data 2025-12-12 20:48:10 +01:00
docker-compose.yml refactor: restructure 2025-11-26 03:03:24 +01:00
docker-entrypoint.sh feat: integrate shared PageHeader and ProfilePage across all web apps 2025-11-30 00:06:29 +01:00
Dockerfile feat(docker): add shared NestJS builder base image 2026-03-21 10:48:31 +01:00
drizzle.config.ts 🔧 chore: create @manacore/shared-drizzle-config and migrate 16 configs 2026-01-29 16:54:44 +01:00
eslint.config.mjs improve code quality 2025-12-03 23:42:37 +01:00
jest.config.js fix(chat,picture,mukke): production readiness audit fixes and tests 2026-03-19 14:46:29 +01:00
nest-cli.json 🔀 merge: auth/complete branch with Better Auth implementation 2025-12-01 15:25:38 +01:00
package.json feat: add unified @manacore/shared-llm package and migrate all backends 2026-03-23 22:06:30 +01:00
tsconfig.build.json style: auto-format codebase with Prettier 2025-11-27 18:33:16 +01:00
tsconfig.json 🐛 fix: resolve tsconfig issues across all NestJS backends 2026-02-01 03:47:17 +01:00