mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-18 04:54:33 +00:00
fix(models): match model names on version boundary, not bare prefix
A bare startsWith let an unlisted future minor collapse into the base entry (gpt-5.6 -> "GPT-5"), the same mis-bucketing class as #420 but for non-Claude families. Require an exact match or a key-plus-dash boundary in both getShortModelName and the Codex provider so new versions fall through to their raw id instead of a wrong name and pricing tier.
This commit is contained in:
parent
0520ecbde8
commit
3fa255fefc
2 changed files with 10 additions and 3 deletions
|
|
@ -478,7 +478,10 @@ export function getShortModelName(model: string): string {
|
|||
const claude = deriveClaudeShortName(canonical)
|
||||
if (claude) return claude
|
||||
for (const [key, name] of SORTED_SHORT_NAMES) {
|
||||
if (canonical.startsWith(key)) return name
|
||||
// Match on a version boundary, not a bare prefix: an unlisted future minor
|
||||
// (e.g. gpt-5.6) must NOT collapse into the base "gpt-5" entry — it should
|
||||
// fall through to its raw id rather than show a wrong name/tier.
|
||||
if (canonical === key || canonical.startsWith(key + '-')) return name
|
||||
}
|
||||
return canonical
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ const modelDisplayNames: Record<string, string> = {
|
|||
'gpt-4o': 'GPT-4o',
|
||||
}
|
||||
|
||||
// Longest-first + version-boundary match so an unlisted future minor (gpt-5.6)
|
||||
// falls through to its raw id instead of collapsing into the base "GPT-5" entry.
|
||||
const modelDisplayEntries = Object.entries(modelDisplayNames).sort((a, b) => b[0].length - a[0].length)
|
||||
|
||||
const toolNameMap: Record<string, string> = {
|
||||
exec_command: 'Bash',
|
||||
read_file: 'Read',
|
||||
|
|
@ -589,8 +593,8 @@ export function createCodexProvider(codexDir?: string): Provider {
|
|||
displayName: 'Codex',
|
||||
|
||||
modelDisplayName(model: string): string {
|
||||
for (const [key, name] of Object.entries(modelDisplayNames)) {
|
||||
if (model.startsWith(key)) return name
|
||||
for (const [key, name] of modelDisplayEntries) {
|
||||
if (model === key || model.startsWith(key + '-')) return name
|
||||
}
|
||||
return model
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue