Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 8addaa7

Browse files
committed
fix: custom model name merging
1 parent a96bf8e commit 8addaa7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/opencode/src/provider/provider.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Auth } from "../auth"
1212
import { Instance } from "../project/instance"
1313
import { Global } from "../global"
1414
import { Flag } from "../flag/flag"
15+
import { iife } from "@/util/iife"
1516

1617
export namespace Provider {
1718
const log = Log.create({ service: "provider" })
@@ -290,9 +291,14 @@ export namespace Provider {
290291

291292
for (const [modelID, model] of Object.entries(provider.models ?? {})) {
292293
const existing = parsed.models[model.id ?? modelID]
294+
const name = iife(() => {
295+
if (model.name) return model.name
296+
if (model.id && model.id !== modelID) return modelID
297+
return existing?.name ?? modelID
298+
})
293299
const parsedModel: ModelsDev.Model = {
294300
id: modelID,
295-
name: model.name ?? existing?.name ?? modelID,
301+
name,
296302
release_date: model.release_date ?? existing?.release_date,
297303
attachment: model.attachment ?? existing?.attachment ?? false,
298304
reasoning: model.reasoning ?? existing?.reasoning ?? false,

0 commit comments

Comments
 (0)