mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 08:58:06 +01:00
Create lib/chat/ module with shared utilities: - embedding.ts: generateEmbeddingWithTimeout (embedding + timeout guard) - settings.ts: getUserLLMSettings (provider/apiKey/ollamaUrl lookup) - context.ts: truncateChunks + joinContext (context building) - llm-errors.ts: handleLLMError (API key fallback, Ollama, AI unavailable) - parse.ts: parseResponseWithSuggestions (extract >>> suggestions) Update all 3 chat routes to use shared utilities, removing ~220 lines of duplicated code. Also fix module-scope getServerEnv() call in llm-client that caused SSG build failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>