fix(app): model selection persist by session (#17348)
This commit is contained in:
parent
5c7088338c
commit
4ad8116ce3
19 changed files with 969 additions and 440 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue