fix(app): model selection persist by session (#17348)

This commit is contained in:
Adam 2026-03-13 11:05:08 -05:00 committed by GitHub
commit 4ad8116ce3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 969 additions and 440 deletions

View file

@ -14,7 +14,7 @@ type Model = AgentModel & {
type VariantInput = {
variants: string[]
selected: string | undefined
selected: string | null | undefined
configured: string | undefined
}
@ -29,6 +29,7 @@ export function getConfiguredAgentVariant(input: { agent: Agent | undefined; mod
}
export function resolveModelVariant(input: VariantInput) {
if (input.selected === null) return undefined
if (input.selected && input.variants.includes(input.selected)) return input.selected
if (input.configured && input.variants.includes(input.configured)) return input.configured
return undefined
@ -36,6 +37,7 @@ export function resolveModelVariant(input: VariantInput) {
export function cycleModelVariant(input: VariantInput) {
if (input.variants.length === 0) return undefined
if (input.selected === null) return input.variants[0]
if (input.selected && input.variants.includes(input.selected)) {
const index = input.variants.indexOf(input.selected)
if (index === input.variants.length - 1) return undefined