From 75186ddadbfca4879efb9ed1460be7cabc38427e Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 25 Aug 2025 10:58:37 -0700 Subject: [PATCH 1/3] fix: show autodetected in model titles --- core/config/load.ts | 3 ++- core/config/yaml/models.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index f7bb01834..2e8a812ce 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -277,11 +277,12 @@ async function intermediateToFinalConfig({ const modelNames = await llm.listModels(); const detectedModels = await Promise.all( modelNames.map(async (modelName) => { + const autodetectTitle = `${desc.title || desc.model} (auto-detected)`; return await llmFromDescription( { ...desc, model: modelName, - title: modelName, + title: autodetectTitle, }, ide.readFile.bind(ide), getUriFromPath, diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index 102e4152b..c342dc0ef 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -173,12 +173,12 @@ async function autodetectModels({ if (modelName === AUTODETECT) { return undefined; } - + const autodetectTitle = `${modelName} (auto-detected)`; return await modelConfigToBaseLLM({ model: { ...model, model: modelName, - name: modelName, + name: autodetectTitle, }, uniqueId, ideSettings, From bf8b4bd8c1d24a85fc9445073ffeb6f4d3edad57 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 25 Aug 2025 14:48:42 -0700 Subject: [PATCH 2/3] fix: pass autodetected around as boolean --- core/config/load.ts | 6 ++++-- core/config/yaml/models.ts | 7 +++++-- core/index.d.ts | 3 +++ core/llm/index.ts | 5 ++++- core/llm/llms/Ollama.ts | 2 +- core/llm/llms/Vllm.ts | 2 +- gui/src/components/modelSelection/ModelSelect.tsx | 5 +++++ 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index 2e8a812ce..b4f9896f3 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -277,12 +277,12 @@ async function intermediateToFinalConfig({ const modelNames = await llm.listModels(); const detectedModels = await Promise.all( modelNames.map(async (modelName) => { - const autodetectTitle = `${desc.title || desc.model} (auto-detected)`; return await llmFromDescription( { ...desc, model: modelName, - title: autodetectTitle, + title: modelName, + isFromAutoDetect: true, }, ide.readFile.bind(ide), getUriFromPath, @@ -320,6 +320,7 @@ async function intermediateToFinalConfig({ ...desc.options, model: modelName, logger: llmLogger, + isFromAutoDetect: true, }, }), ); @@ -627,6 +628,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription { apiKeyLocation: llm.apiKeyLocation, envSecretLocations: llm.envSecretLocations, sourceFile: llm.sourceFile, + isFromAutoDetect: llm.isFromAutoDetect, }; } diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index c342dc0ef..45cbdcbfb 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -32,12 +32,14 @@ async function modelConfigToBaseLLM({ ideSettings, llmLogger, config, + isFromAutoDetect, }: { model: ModelConfig; uniqueId: string; ideSettings: IdeSettings; llmLogger: ILLMLogger; config: ContinueConfig; + isFromAutoDetect?: boolean; }): Promise { const cls = getModelClass(model); @@ -71,6 +73,7 @@ async function modelConfigToBaseLLM({ nextEdit: model.capabilities?.includes("next_edit"), }, autocompleteOptions: model.autocompleteOptions, + isFromAutoDetect, }; // Model capabilities - need to be undefined if not found @@ -173,17 +176,17 @@ async function autodetectModels({ if (modelName === AUTODETECT) { return undefined; } - const autodetectTitle = `${modelName} (auto-detected)`; return await modelConfigToBaseLLM({ model: { ...model, model: modelName, - name: autodetectTitle, + name: modelName, }, uniqueId, ideSettings, llmLogger, config, + isFromAutoDetect: true, }); }), ); diff --git a/core/index.d.ts b/core/index.d.ts index 90039f025..b1811c20e 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -666,6 +666,7 @@ export interface LLMOptions { env?: Record; sourceFile?: string; + isFromAutoDetect?: boolean; } type RequireAtLeastOne = Pick< @@ -1175,6 +1176,7 @@ export interface ModelDescription { configurationStatus?: LLMConfigurationStatuses; sourceFile?: string; + isFromAutoDetect?: boolean; } export interface JSONEmbedOptions { @@ -1605,6 +1607,7 @@ export interface JSONModelDescription { aiGatewaySlug?: string; useLegacyCompletionsEndpoint?: boolean; deploymentId?: string; + isFromAutoDetect?: boolean; } // config.json diff --git a/core/llm/index.ts b/core/llm/index.ts index edbfecbdb..1a0330eaa 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -9,7 +9,6 @@ import { import Handlebars from "handlebars"; import { DevDataSqliteDb } from "../data/devdataSqlite.js"; -import { Logger } from "../util/Logger.js"; import { DataLogger } from "../data/log.js"; import { CacheBehavior, @@ -31,6 +30,7 @@ import { TemplateType, Usage, } from "../index.js"; +import { Logger } from "../util/Logger.js"; import mergeJson from "../util/merge.js"; import { renderChatMessage } from "../util/messageContent.js"; import { isOllamaInstalled } from "../util/ollamaHelper.js"; @@ -191,6 +191,8 @@ export abstract class BaseLLM implements ILLM { //URI to local block defining this LLM sourceFile?: string; + isFromAutoDetect?: boolean; + private _llmOptions: LLMOptions; protected openaiAdapter?: BaseLlmApi; @@ -294,6 +296,7 @@ export abstract class BaseLLM implements ILLM { this.autocompleteOptions = options.autocompleteOptions; this.sourceFile = options.sourceFile; + this.isFromAutoDetect = options.isFromAutoDetect; } get contextLength() { diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index a944f90f9..a1c4c2046 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -148,7 +148,7 @@ class Ollama extends BaseLLM implements ModelInstaller { constructor(options: LLMOptions) { super(options); - if (options.model === "AUTODETECT") { + if (options.isFromAutoDetect) { return; } const headers: Record = { diff --git a/core/llm/llms/Vllm.ts b/core/llm/llms/Vllm.ts index 97bd936cb..82466312b 100644 --- a/core/llm/llms/Vllm.ts +++ b/core/llm/llms/Vllm.ts @@ -25,7 +25,7 @@ class Vllm extends OpenAI { constructor(options: LLMOptions) { super(options); - if (options.model === "AUTODETECT") { + if (options.isFromAutoDetect) { this._setupCompletionOptions(); } } diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 5aa221609..a31d1d0e8 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -37,6 +37,7 @@ interface Option { title: string; apiKey?: string; sourceFile?: string; + isAutoDetected?: boolean; } function modelSelectTitle(model: any): string { @@ -75,6 +76,9 @@ function ModelOption({ {option.title} + {option.isAutoDetected && ( + (autodetected) + )} {showMissingApiKeyMsg && ( (Missing API key) )} @@ -132,6 +136,7 @@ function ModelSelect() { title: modelSelectTitle(model), apiKey: model.apiKey, sourceFile: model.sourceFile, + isAutoDetected: model.isFromAutoDetect, }; }), ); From 537190ee362a9a81c98cd38e57d700eb849e3d3e Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 25 Aug 2025 14:50:55 -0700 Subject: [PATCH 3/3] fix: autodetect UI tweaks --- gui/src/components/modelSelection/ModelSelect.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index a31d1d0e8..3108e7089 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -77,10 +77,14 @@ function ModelOption({ {option.title} {option.isAutoDetected && ( - (autodetected) + + (autodetected) + )} {showMissingApiKeyMsg && ( - (Missing API key) + + (Missing API key) + )}