From 892c3ae202e8697be64f6a410f85f2de67d142d1 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sat, 2 Aug 2025 07:48:48 +0000 Subject: [PATCH] fix: allow Ollama to connect to external servers without model validation blocking - Modified validation logic to only validate Ollama models when there are more than 1 model in the list - This prevents blocking users from connecting to external Ollama servers where model discovery might not work properly - Fixes issue #6589 where users could not connect to non-localhost Ollama instances --- webview-ui/src/utils/validate.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/webview-ui/src/utils/validate.ts b/webview-ui/src/utils/validate.ts index 3b85ef9919..bdcfa12f30 100644 --- a/webview-ui/src/utils/validate.ts +++ b/webview-ui/src/utils/validate.ts @@ -259,7 +259,19 @@ export function validateModelId(apiConfiguration: ProviderSettings, routerModels const models = routerModels?.[provider] - if (models && Object.keys(models).length > 1 && !Object.keys(models).includes(modelId)) { + // For Ollama, we should not validate against the model list if it's empty or has only one model + // This allows users to connect to external Ollama servers where model discovery might not work + if (provider === "ollama") { + // Only validate if we have a substantial list of models (more than 1) + // This prevents blocking users from using custom models on external servers + if (models && Object.keys(models).length > 1 && !Object.keys(models).includes(modelId)) { + return i18next.t("settings:validation.modelAvailability", { modelId }) + } + return undefined + } + + // For other providers, validate if we have any models in the list + if (models && Object.keys(models).length > 0 && !Object.keys(models).includes(modelId)) { return i18next.t("settings:validation.modelAvailability", { modelId }) }