fix(ollama-local): support custom host URL for remote Ollama servers (closes #578)

Add a shared resolveOllamaLocalHost() helper and wire it through the
executor, models/validate/test routes, so users can point ollama-local
at a remote Ollama instance instead of being locked to localhost:11434.

Also expose the host as an "Ollama Host URL" field in AddApiKeyModal
(empty = default localhost:11434), making the option reachable from the
dashboard without hand-editing db.json.

Co-authored-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
Made-with: Cursor
This commit is contained in:
anuragg-saxenaa authored and decolua committed 2026-04-22 10:45:46 +07:00
1 parent 94ab0d715d
commit 4638cf0e81
6 files changed
+77 -31

No files matched your search

+4 -3
View File
@@ -3,6 +3,7 @@ import { resolveConnectionProxyConfig } from "@/lib/network/connectionProxy";
import { testProxyUrl } from "@/lib/network/proxyTest";
import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider } from "@/shared/constants/providers";
import { getDefaultModel } from "open-sse/config/providerModels.js";
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
import {
GEMINI_CONFIG,
ANTIGRAVITY_CONFIG,
@@ -495,9 +496,9 @@ async function testApiKeyConnection(connection, effectiveProxy = null) {
return { valid: res.ok, error: res.ok ? null : "Invalid API key" };
}
case "ollama-local": {
// No auth required for local Ollama
const res = await fetch("http://localhost:11434/api/tags");
return { valid: res.ok, error: res.ok ? null : "Ollama not running on localhost:11434" };
const host = resolveOllamaLocalHost(connection);
const res = await fetch(`${host}/api/tags`);
return { valid: res.ok, error: res.ok ? null : `Ollama not reachable at ${host}` };
}
case "deepgram": {
const res = await fetchWithConnectionProxy("https://api.deepgram.com/v1/projects", { headers: { Authorization: `Token ${connection.apiKey}` } }, effectiveProxy);