GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: keep vendor prefixes when the rest names no model · pingdotgg/t3code@e5b2da1

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/provider
    • modelShortName.test.ts
    • modelShortName.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/provider/modelShortName.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/modelShortName.test.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ describe("modelShortName", () => {
1919
["Gemini 3.1 Pro Preview Custom Tools", "opencode", undefined],
2020
["NVIDIA: Nemotron 3 Super", "opencode", "Nemotron 3 Super"],
2121
["Google: Gemini 3.1 Pro", "opencode", "Gemini 3.1 Pro"],
22+
["Google: 3.1 Pro", "opencode", undefined],
2223
["GPT-5.4 Mini", "pi", undefined],
2324
["GPT-5.5", "codex", undefined],
2425
["GPT-4o", "opencode", undefined],
Collapse file

‎apps/server/src/provider/modelShortName.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/modelShortName.ts
+14-12Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,31 @@ const VENDOR_PREFIX = /^[A-Z][\w.&\- ]{0,24}: (?=\S)/;
4848

4949
export function modelShortName(name: string, driver: string): string | undefined {
5050
const unprefixed = name.replace(VENDOR_PREFIX, "");
51-
const short = withoutFamily(unprefixed, driver) ?? unprefixed;
51+
const short = withoutFamily(unprefixed, driver) ?? (namesModel(unprefixed) ? unprefixed : name);
5252
return short === name ? undefined : short;
5353
}
5454

5555
function withoutFamily(name: string, driver: string): string | undefined {
5656
const family = MODEL_FAMILIES.find((candidate) => name.startsWith(candidate.prefix));
5757
if (!family) return undefined;
5858
const rest = name.slice(family.prefix.length).trim();
59-
const words = rest
60-
.replace(/\(.*?\)/g, " ")
61-
.split(/[\s-]+/)
62-
.filter(Boolean);
63-
const named = words.filter((word) => !VERSION.test(word));
59+
const named = nonVersionWords(rest);
6460
if (named.length === 0) return undefined;
65-
if (
66-
!family.nativeDrivers.includes(driver) &&
67-
named.every((word) => VARIANT_WORDS.has(word.toLowerCase()))
68-
) {
69-
return undefined;
70-
}
61+
if (!family.nativeDrivers.includes(driver) && !namesModel(rest)) return undefined;
7162
return rest.replace(/(?<=\S)-(?=\S)/g, " ");
7263
}
7364

65+
function nonVersionWords(text: string): ReadonlyArray<string> {
66+
return text
67+
.replace(/\(.*?\)/g, " ")
68+
.split(/[\s-]+/)
69+
.filter((word) => word.length > 0 && !VERSION.test(word));
70+
}
71+
72+
function namesModel(text: string): boolean {
73+
return nonVersionWords(text).some((word) => !VARIANT_WORDS.has(word.toLowerCase()));
74+
}
75+
7476
export function withModelShortNames(provider: ServerProvider): ServerProvider {
7577
let changed = false;
7678
const models = provider.models.map((model) => {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.