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:
1 parent
94ab0d715d
commit
4638cf0e81
6 files changed
+77
-31
No files matched your search
@@ -4,6 +4,7 @@ import { isOpenAICompatibleProvider, isAnthropicCompatibleProvider } from "@/sha
|
||||
import { KiroService } from "@/lib/oauth/services/kiro";
|
||||
import { GEMINI_CONFIG } from "@/lib/oauth/constants/oauth";
|
||||
import { refreshGoogleToken, updateProviderCredentials, refreshKiroToken } from "@/sse/services/tokenRefresh";
|
||||
import { resolveOllamaLocalHost } from "open-sse/config/providers.js";
|
||||
|
||||
const GEMINI_CLI_MODELS_URL = "https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels";
|
||||
|
||||
@@ -380,13 +381,8 @@ export async function GET(request, { params }) {
|
||||
});
|
||||
}
|
||||
|
||||
// Handle ollama-local: resolve URL from providerSpecificData.baseUrl if provided,
|
||||
// otherwise fall back to default localhost address.
|
||||
if (connection.provider === "ollama-local") {
|
||||
const baseUrl = connection.providerSpecificData?.baseUrl;
|
||||
const url = baseUrl
|
||||
? `${baseUrl.replace(/\/$/, "")}/api/tags`
|
||||
: "http://localhost:11434/api/tags";
|
||||
const url = `${resolveOllamaLocalHost(connection)}/api/tags`;
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
||||
Reference in new issue
Block a user