From 954d91cfe8d3d9a684213d6aba9b513dd5ddc2a9 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 6 Mar 2025 11:59:46 -0800 Subject: [PATCH 1/2] better autodetect names --- core/config/load.ts | 3 ++- core/config/yaml/models.ts | 3 ++- core/util/text.ts | 6 ++++++ gui/src/components/modelSelection/ModelSelectionListbox.tsx | 3 +-- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 core/util/text.ts diff --git a/core/config/load.ts b/core/config/load.ts index 873577d8c..8005ff555 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -71,6 +71,7 @@ import { } from "../util/paths"; import { localPathToUri } from "../util/pathToUri"; +import { capitalizeFirstLetter } from "../util/text"; import { defaultContextProvidersJetBrains, defaultContextProvidersVsCode, @@ -272,7 +273,7 @@ async function intermediateToFinalConfig( { ...desc, model: modelName, - title: `${llm.title} - ${modelName}`, + title: `${modelName} - ${llm.title?.toUpperCase() === "AUTODETECT" ? capitalizeFirstLetter(llm.providerName) : llm.title} (Autodetect)`, }, ide.readFile.bind(ide), uniqueId, diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index c6916b010..240a7044e 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -3,6 +3,7 @@ import { ModelConfig } from "@continuedev/config-yaml"; import { IDE, IdeSettings, LLMOptions } from "../.."; import { BaseLLM } from "../../llm"; import { LLMClasses } from "../../llm/llms"; +import { capitalizeFirstLetter } from "../../util/text"; import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; const AUTODETECT = "AUTODETECT"; @@ -127,7 +128,7 @@ async function autodetectModels( { ...model, model: modelName, - name: `${llm.title} - ${modelName}`, + name: `${modelName} - ${llm.title?.toUpperCase() === "AUTODETECT" ? capitalizeFirstLetter(llm.providerName) : llm.title} (Autodetect)`, }, uniqueId, ideSettings, diff --git a/core/util/text.ts b/core/util/text.ts new file mode 100644 index 000000000..e4870dfa0 --- /dev/null +++ b/core/util/text.ts @@ -0,0 +1,6 @@ +export const capitalizeFirstLetter = (val: string) => { + if (val.length === 0) { + return ""; + } + return val[0].toUpperCase() + val.slice(1); +}; diff --git a/gui/src/components/modelSelection/ModelSelectionListbox.tsx b/gui/src/components/modelSelection/ModelSelectionListbox.tsx index d48ffceed..596cddb9b 100644 --- a/gui/src/components/modelSelection/ModelSelectionListbox.tsx +++ b/gui/src/components/modelSelection/ModelSelectionListbox.tsx @@ -1,11 +1,10 @@ -import { Transition } from "@headlessui/react"; +import { Listbox, Transition } from "@headlessui/react"; import { CheckIcon, ChevronUpDownIcon, CubeIcon, } from "@heroicons/react/24/outline"; import { Fragment } from "react"; -import { Listbox } from "@headlessui/react"; import styled from "styled-components"; import { defaultBorderRadius, From 0917ddf9a534891c267d659de7f776df59bad65d Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Mar 2025 22:53:42 -0800 Subject: [PATCH 2/2] remove "Autodetect" --- core/config/load.ts | 3 +-- core/config/yaml/models.ts | 3 +-- extensions/vscode/package-lock.json | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/config/load.ts b/core/config/load.ts index 8005ff555..3636b4bf8 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -71,7 +71,6 @@ import { } from "../util/paths"; import { localPathToUri } from "../util/pathToUri"; -import { capitalizeFirstLetter } from "../util/text"; import { defaultContextProvidersJetBrains, defaultContextProvidersVsCode, @@ -273,7 +272,7 @@ async function intermediateToFinalConfig( { ...desc, model: modelName, - title: `${modelName} - ${llm.title?.toUpperCase() === "AUTODETECT" ? capitalizeFirstLetter(llm.providerName) : llm.title} (Autodetect)`, + title: modelName, }, ide.readFile.bind(ide), uniqueId, diff --git a/core/config/yaml/models.ts b/core/config/yaml/models.ts index 240a7044e..b4392d519 100644 --- a/core/config/yaml/models.ts +++ b/core/config/yaml/models.ts @@ -3,7 +3,6 @@ import { ModelConfig } from "@continuedev/config-yaml"; import { IDE, IdeSettings, LLMOptions } from "../.."; import { BaseLLM } from "../../llm"; import { LLMClasses } from "../../llm/llms"; -import { capitalizeFirstLetter } from "../../util/text"; import { PlatformConfigMetadata } from "../profile/PlatformProfileLoader"; const AUTODETECT = "AUTODETECT"; @@ -128,7 +127,7 @@ async function autodetectModels( { ...model, model: modelName, - name: `${modelName} - ${llm.title?.toUpperCase() === "AUTODETECT" ? capitalizeFirstLetter(llm.providerName) : llm.title} (Autodetect)`, + name: modelName, }, uniqueId, ideSettings, diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index cbcebc34e..ed46978a0 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.3", + "version": "1.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.3", + "version": "1.1.4", "license": "Apache-2.0", "dependencies": { "@continuedev/fetch": "^1.0.3",