From 0918bb4216aef60fcefb3025a105cf6d250de52b Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:19:59 +0000 Subject: [PATCH] fix(vscode): preserve 'Free' in model names like 'Kilo Auto Free' Only strip the parenthesized '(free)' suffix; bare trailing 'Free' is part of the name and must be kept. A separate Free label is rendered elsewhere. --- .changeset/preserve-free-in-model-names.md | 5 ++++ .../tests/unit/model-selector-utils.test.ts | 30 ++++++++----------- .../components/shared/model-selector-utils.ts | 10 +++---- 3 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 .changeset/preserve-free-in-model-names.md diff --git a/.changeset/preserve-free-in-model-names.md b/.changeset/preserve-free-in-model-names.md new file mode 100644 index 0000000000..738c165d2a --- /dev/null +++ b/.changeset/preserve-free-in-model-names.md @@ -0,0 +1,5 @@ +--- +"kilo-code": patch +--- + +Preserve "Free" when it is part of a model's name (such as "Kilo Auto Free"). The parenthesized "(free)" suffix is still stripped so the separate Free label can be shown instead. diff --git a/packages/kilo-vscode/tests/unit/model-selector-utils.test.ts b/packages/kilo-vscode/tests/unit/model-selector-utils.test.ts index ec29af0b2c..0af708775a 100644 --- a/packages/kilo-vscode/tests/unit/model-selector-utils.test.ts +++ b/packages/kilo-vscode/tests/unit/model-selector-utils.test.ts @@ -66,24 +66,20 @@ describe("sanitizeName", () => { expect(sanitizeName("Llama 3 (free)")).toBe("Llama 3") }) - it("strips trailing free suffix", () => { - expect(sanitizeName("Mixtral free")).toBe("Mixtral") - }) - - it("strips trailing :free suffix", () => { - expect(sanitizeName("Mistral:free")).toBe("Mistral") - }) - - it("strips trailing -free suffix", () => { - expect(sanitizeName("Gemma-free")).toBe("Gemma") - }) - - it("is case-insensitive", () => { + it("is case-insensitive for parenthesized suffix", () => { expect(sanitizeName("Model (Free)")).toBe("Model") - expect(sanitizeName("Model FREE")).toBe("Model") + expect(sanitizeName("Model (FREE)")).toBe("Model") }) - it("leaves names without free suffix unchanged", () => { + it("preserves bare trailing Free in names like 'Kilo Auto Free'", () => { + expect(sanitizeName("Kilo Auto Free")).toBe("Kilo Auto Free") + expect(sanitizeName("Mixtral free")).toBe("Mixtral free") + expect(sanitizeName("Mistral:free")).toBe("Mistral:free") + expect(sanitizeName("Gemma-free")).toBe("Gemma-free") + expect(sanitizeName("Model FREE")).toBe("Model FREE") + }) + + it("leaves names without (free) suffix unchanged", () => { expect(sanitizeName("GPT-4o")).toBe("GPT-4o") expect(sanitizeName("Claude Sonnet")).toBe("Claude Sonnet") }) @@ -92,9 +88,9 @@ describe("sanitizeName", () => { expect(sanitizeName("FreeAgent Pro")).toBe("FreeAgent Pro") }) - it("handles extra whitespace around suffix", () => { + it("handles extra whitespace around (free) suffix", () => { expect(sanitizeName("Llama 3 (free) ")).toBe("Llama 3") - expect(sanitizeName("Model free ")).toBe("Model") + expect(sanitizeName("Model (free) ")).toBe("Model") }) }) diff --git a/packages/kilo-vscode/webview-ui/src/components/shared/model-selector-utils.ts b/packages/kilo-vscode/webview-ui/src/components/shared/model-selector-utils.ts index 270c03b0d8..fb5e3e35f4 100644 --- a/packages/kilo-vscode/webview-ui/src/components/shared/model-selector-utils.ts +++ b/packages/kilo-vscode/webview-ui/src/components/shared/model-selector-utils.ts @@ -22,13 +22,11 @@ export function isFree(model: Pick): boolean { return model.isFree === true } -// Strips trailing free-indicator suffixes from model display names, e.g. -// "Llama 3 (free)" → "Llama 3", "Mixtral free" → "Mixtral" +// Strips trailing "(free)" parenthesized suffix from model display names, e.g. +// "Llama 3 (free)" → "Llama 3". A separate "Free" label/tag is rendered +// elsewhere, so preserve bare trailing "Free" words (e.g. "Kilo Auto Free"). export function sanitizeName(name: string): string { - return name - .replace(/[\s:_-]*\(free\)\s*$/i, "") - .replace(/[\s:_-]+free\s*$/i, "") - .trim() + return name.replace(/[\s:_-]*\(free\)\s*$/i, "").trim() } export function stripSubProviderPrefix(name: string): string {