Commit Graph
1 Commits
Author SHA1 Message Date
Justin BollingerandClaude 2376ac5c10 fix(llm): only prepend http:// to OLLAMA_HOST when no scheme is present
ollamaUrl was built as "http://" + OLLAMA_HOST, so any value carrying a scheme
- the form Ollama's own tooling accepts - was mangled:

    OLLAMA_HOST=https://ollama.example.com
    -> http://https://ollama.example.com

The LLM attack then could not connect, and reaching a remote Ollama over TLS
was impossible. llm.py derives its client base URL as f"{ollamaUrl}/v1", so the
malformation propagated into the OpenAI-compatible client.

Extract _normalize_ollama_url() so the logic is unit-testable - ollamaUrl is
assigned at module import, which is otherwise only reachable via reload - and
prepend the scheme only when absent. Also strip trailing slashes, since callers
append paths. The bare host:port default is unchanged.

Fixes #119

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-24 19:19:38 -04:00