The open source coding agent.
TypeScript
rework default model
Dax Raad7c0cc94023bc
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.tsindex 62b08d955e2..774860ffb56 100644--- a/packages/opencode/src/provider/provider.ts+++ b/packages/opencode/src/provider/provider.ts@@ -627,7 +627,7 @@ export namespace Provider {}}- const priority = ["gemini-2.5-pro-preview", "gpt-5", "claude-sonnet-4", "big-pickle"]+ const priority = ["gpt-5", "claude-sonnet-4", "big-pickle", "gemini-3-pro"]export function sort(models: ModelsDev.Model[]) {return sortBy(models,@@ -641,42 +641,6 @@ export namespace Provider {const cfg = await Config.get()if (cfg.model) return parseModel(cfg.model)- // this will be adjusted when migration to opentui is complete,- // for now we just read the tui state toml file directly- //- // NOTE: cannot just import file as toml without cleaning due to lack of- // support for date/time references in Bun toml parser: https://github.com/oven-sh/bun/issues/22426- const lastused = await Bun.file(path.join(Global.Path.state, "tui"))- .text()- .then((text) => {- // remove the date/time references since Bun toml parser doesn't support yet- const cleaned = text- .split("\n")- .filter((line) => !line.trim().startsWith("last_used ="))- .join("\n")- const state = Bun.TOML.parse(cleaned) as {- recently_used_models?: {- provider_id: string- model_id: string- }[]- }- const [model] = state?.recently_used_models ?? []- if (model) {- return {- providerID: model.provider_id,- modelID: model.model_id,- }- }- })- .catch((error) => {- log.error("failed to find last used model", {- error,- })- return undefined- })-- if (lastused) return lastused-const provider = await list().then((val) => Object.values(val)).then((x) => x.find((p) => !cfg.provider || Object.keys(cfg.provider).includes(p.info.id)))