fix(quick-pane): refresh models and window lifecycle
This commit is contained in:
@@ -29,6 +29,23 @@ export function modelIdentityFromValue(
|
||||
}
|
||||
}
|
||||
|
||||
export function reconcileModelIdentity(
|
||||
models: Model[],
|
||||
preferred: ModelIdentity,
|
||||
): ModelIdentity | undefined {
|
||||
const identities = models
|
||||
.map(modelIdentity)
|
||||
.filter((identity): identity is ModelIdentity => !!identity);
|
||||
const preferredValue = modelIdentityValue(preferred);
|
||||
return (
|
||||
identities.find(
|
||||
(identity) => modelIdentityValue(identity) === preferredValue,
|
||||
) ??
|
||||
identities.find((identity) => identity.provider === preferred.provider) ??
|
||||
identities[0]
|
||||
);
|
||||
}
|
||||
|
||||
export function catalogModels(
|
||||
models: Model[],
|
||||
configured: ModelIdentity[],
|
||||
|
||||
Reference in New Issue
Block a user