Merge pull request #7393 from continuedev/dallin/autodetect-naming

fix: show autodetected in model titles
This commit is contained in:
Dallin Romney 2025-08-25 15:02:16 -07:00 • committed by GitHub
commit 28c6622b96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 26 additions and 5 deletions

View file

@ -282,6 +282,7 @@ async function intermediateToFinalConfig({
...desc,
model: modelName,
title: modelName,
isFromAutoDetect: true,
},
ide.readFile.bind(ide),
getUriFromPath,
@ -319,6 +320,7 @@ async function intermediateToFinalConfig({
...desc.options,
model: modelName,
logger: llmLogger,
isFromAutoDetect: true,
},
}),
);
@ -626,6 +628,7 @@ function llmToSerializedModelDescription(llm: ILLM): ModelDescription {
apiKeyLocation: llm.apiKeyLocation,
envSecretLocations: llm.envSecretLocations,
sourceFile: llm.sourceFile,
isFromAutoDetect: llm.isFromAutoDetect,
};
}

View file

@ -32,12 +32,14 @@ async function modelConfigToBaseLLM({
ideSettings,
llmLogger,
config,
isFromAutoDetect,
}: {
model: ModelConfig;
uniqueId: string;
ideSettings: IdeSettings;
llmLogger: ILLMLogger;
config: ContinueConfig;
isFromAutoDetect?: boolean;
}): Promise<BaseLLM | undefined> {
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,7 +176,6 @@ async function autodetectModels({
if (modelName === AUTODETECT) {
return undefined;
}
return await modelConfigToBaseLLM({
model: {
...model,
@ -184,6 +186,7 @@ async function autodetectModels({
ideSettings,
llmLogger,
config,
isFromAutoDetect: true,
});
}),
);

3
core/index.d.ts vendored
View file

@ -666,6 +666,7 @@ export interface LLMOptions {
env?: Record<string, string | number | boolean>;
sourceFile?: string;
isFromAutoDetect?: boolean;
}
type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
@ -1177,6 +1178,7 @@ export interface ModelDescription {
configurationStatus?: LLMConfigurationStatuses;
sourceFile?: string;
isFromAutoDetect?: boolean;
}
export interface JSONEmbedOptions {
@ -1607,6 +1609,7 @@ export interface JSONModelDescription {
aiGatewaySlug?: string;
useLegacyCompletionsEndpoint?: boolean;
deploymentId?: string;
isFromAutoDetect?: boolean;
}
// config.json

View file

@ -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() {

View file

@ -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<string, string> = {

View file

@ -25,7 +25,7 @@ class Vllm extends OpenAI {
constructor(options: LLMOptions) {
super(options);
if (options.model === "AUTODETECT") {
if (options.isFromAutoDetect) {
this._setupCompletionOptions();
}
}

View file

@ -37,6 +37,7 @@ interface Option {
title: string;
apiKey?: string;
sourceFile?: string;
isAutoDetected?: boolean;
}
function modelSelectTitle(model: any): string {
@ -75,8 +76,15 @@ function ModelOption({
<CubeIcon className="h-3 w-3 flex-shrink-0" />
<span className="line-clamp-1">
{option.title}
{option.isAutoDetected && (
<span className="text-description-muted ml-1.5 text-[10px] italic">
(autodetected)
</span>
)}
{showMissingApiKeyMsg && (
<span className="ml-2 text-[10px] italic">(Missing API key)</span>
<span className="ml-1.5 text-[10px] italic">
(Missing API key)
</span>
)}
</span>
</div>
@ -132,6 +140,7 @@ function ModelSelect() {
title: modelSelectTitle(model),
apiKey: model.apiKey,
sourceFile: model.sourceFile,
isAutoDetected: model.isFromAutoDetect,
};
}),
);