Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: ollamaManager reuses shared normalizeOllamaBaseUrl (#12407)

[._.]/ Adam Eivy6a1559e87b1d
diff --git a/server/services/ollamaManager.js b/server/services/ollamaManager.js
index c513ee8bd7..58652eb611 100644
--- a/server/services/ollamaManager.js
+++ b/server/services/ollamaManager.js
@@ -77,11 +77,10 @@ const HF_IMPORT_METADATA_TIMEOUT_MS = 180_000
const DEFAULT_CONFIG = {
// Ollama uses OLLAMA_HOST (host:port, no scheme) by convention; also accept
// an explicit OLLAMA_URL. Normalize to a scheme + no trailing slash + no /v1.
- baseUrl: normalizeBaseUrl(managedOllamaBaseUrl()),
+ baseUrl: normalizeOllamaBaseUrl(managedOllamaBaseUrl()),
timeout: DEFAULT_REQUEST_TIMEOUT_MS
}
-const normalizeBaseUrl = normalizeOllamaBaseUrl
let config = { ...DEFAULT_CONFIG }
let isAvailable = null
@@ -348,7 +347,7 @@ async function readServiceStatus() {
async function ollamaRequestAt(baseUrl, endpoint, options = {}) {
const { timeout, headers, ...rest } = options
- const response = await fetchWithTimeout(`${normalizeBaseUrl(baseUrl)}${endpoint}`, {
+ const response = await fetchWithTimeout(`${normalizeOllamaBaseUrl(baseUrl)}${endpoint}`, {
...rest,
headers: { 'Content-Type': 'application/json', ...headers }
}, timeout ?? config.timeout)
diff --git a/server/services/voice/llm.js b/server/services/voice/llm.js
index 587b6fa4a8..1e685b3391 100644
--- a/server/services/voice/llm.js
+++ b/server/services/voice/llm.js
@@ -19,7 +19,7 @@ const LM_STUDIO_API_BASE = () => normalizeOpenAiBaseUrl(process.env.LM_STUDIO_UR
// Ollama's OpenAI-compatible surface. `OLLAMA_HOST` is conventionally a BARE
// `host:port` with no scheme (that is how .env.example documents it), so this
// must go through the shared normalizer rather than string-concatenating
-// `/v1` onto it — `localhost:11434/v1` is not a fetchable URL.
+// `/v1` onto it — a bare host:port plus /v1 is not a fetchable URL.
const OLLAMA_API_BASE = () => normalizeOpenAiBaseUrl(managedOllamaBaseUrl());
// Last-resort endpoints when the configured provider resolves to nothing