mirror of
https://github.com/val1813/kwcode.git
synced 2026-09-03 06:34:30 +08:00
Problem: user configures base_url as https://api.deepseek.com during onboarding, but LLMBackend hardcodes /api/chat (Ollama endpoint), resulting in 404 errors on cloud APIs. Solution: auto-detect based on URL pattern: - localhost:11434 → Ollama (/api/chat) - Cloud domains (deepseek/siliconflow/openai/groq/etc) → OpenAI compat (/v1/chat/completions) - Remote non-localhost → OpenAI compat - URL containing /v1 → OpenAI compat Also: - Pass api_key from config to LLMBackend - New _chat_openai_compat() method handles OpenAI format (Authorization header, standard payload) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>