Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/app/src/context/local.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
if (currentAgent) setEphemeral("model", currentAgent.name, next)
if (model) models.setVisibility(model, true)
if (options?.recent && model) models.recent.push(model)
// Persist the model selection to config so child processes inherit it
if (model && !options?.recent) {
sdk.config.set({
directory: sdk.directory,
config: {
model: `${model.providerID}/${model.modelID}`,
},
}).catch((error) => {
console.error("Failed to persist model selection to config", error)
})
}
})
},
visible(model: ModelKey) {
Expand Down
5 changes: 3 additions & 2 deletions packages/opencode/src/acp/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,9 @@ export namespace ACP {
return undefined
})

// If a model is specified in the config file, use it instead of falling back to defaults
if (specified) return specified

const providers = await sdk.config
.providers({ directory }, { throwOnError: true })
.then((x) => x.data?.providers ?? [])
Expand Down Expand Up @@ -1411,8 +1414,6 @@ export namespace ACP {
}
}

if (specified) return specified

return { providerID: "opencode", modelID: "big-pickle" }
}

Expand Down
Loading