fix(tui): preserve selected model on refresh (#25993)

This commit is contained in:
Shoubhit Dash
2026-05-06 14:14:31 +05:30
committed by GitHub
parent 043a5c7c0d
commit d49d217e9d

View File

@@ -397,23 +397,15 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
},
}
// Automatically update model when agent changes
createEffect(() => {
const value = agent.current()
if (!value) return
if (value.model) {
if (isModelValid(value.model))
model.set({
providerID: value.model.providerID,
modelID: value.model.modelID,
})
else
toast.show({
variant: "warning",
message: `Agent ${value.name}'s configured model ${value.model.providerID}/${value.model.modelID} is not valid`,
duration: 3000,
})
}
if (!value?.model) return
if (isModelValid(value.model)) return
toast.show({
variant: "warning",
message: `Agent ${value.name}'s configured model ${value.model.providerID}/${value.model.modelID} is not valid`,
duration: 3000,
})
})
const result = {