Skip to content

Commit 8e34f73

Browse files
committed
Switching agents considers the agent's configured model variant
1 parent 2115df5 commit 8e34f73

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/context

packages/opencode/src/cli/cmd/tui/context/local.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,17 +397,18 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
397397
},
398398
}
399399

400-
// Automatically update model when agent changes
400+
// Automatically update model and variant when agent changes
401401
createEffect(() => {
402402
const value = agent.current()
403403
if (!value) return
404404
if (value.model) {
405-
if (isModelValid(value.model))
405+
if (isModelValid(value.model)) {
406406
model.set({
407407
providerID: value.model.providerID,
408408
modelID: value.model.modelID,
409409
})
410-
else
410+
if (value.variant) model.variant.set(value.variant)
411+
} else
411412
toast.show({
412413
variant: "warning",
413414
message: `Agent ${value.name}'s configured model ${value.model.providerID}/${value.model.modelID} is not valid`,

0 commit comments

Comments
 (0)