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