mirror of
https://github.com/decolua/9router.git
synced 2026-05-08 12:01:28 +00:00
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:
@@ -339,3 +339,10 @@ export const PROVIDERS = {
|
||||
noAuth: true
|
||||
},
|
||||
};
|
||||
|
||||
export const OLLAMA_LOCAL_DEFAULT_HOST = "http://localhost:11434";
|
||||
|
||||
export function resolveOllamaLocalHost(credentials) {
|
||||
const raw = credentials?.providerSpecificData?.baseUrl?.trim();
|
||||
return (raw || OLLAMA_LOCAL_DEFAULT_HOST).replace(/\/$/, "");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { HTTP_STATUS, RETRY_CONFIG, DEFAULT_RETRY_CONFIG } from "../config/runtimeConfig.js";
|
||||
import { resolveOllamaLocalHost } from "../config/providers.js";
|
||||
import { proxyAwareFetch } from "../utils/proxyFetch.js";
|
||||
|
||||
/**
|
||||
@@ -35,6 +36,9 @@ export class BaseExecutor {
|
||||
const normalized = baseUrl.replace(/\/$/, "");
|
||||
return `${normalized}/messages`;
|
||||
}
|
||||
if (this.provider === "ollama-local") {
|
||||
return `${resolveOllamaLocalHost(credentials)}/api/chat`;
|
||||
}
|
||||
const baseUrls = this.getBaseUrls();
|
||||
return baseUrls[urlIndex] || baseUrls[0] || this.config.baseUrl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user