Structured per-provider config block, non-destructive provider switching (#8977)

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Signed-off-by: Aaron Yourk <ayourk@gmail.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
ayourk
2026-05-18 18:22:50 +00:00
committed by GitHub
parent 60c482de25
commit badb97a01e
26 changed files with 1014 additions and 95 deletions
+1
View File
@@ -953,6 +953,7 @@ export type ProviderDetails = {
metadata: ProviderMetadata;
name: string;
provider_type: ProviderType;
saved_model?: string | null;
};
export type ProviderEngine = 'openai' | 'ollama' | 'anthropic';
@@ -594,6 +594,13 @@ export const SwitchModelModal = ({
// Don't auto-select if user explicitly cleared the model
if (!provider || loadingModels || model || isCustomModel || userClearedModel) return;
// Use saved model from provider config if available
const providerInfo = activeProvidersList.find((p) => p.name === provider);
if (providerInfo?.saved_model) {
setModel(providerInfo.saved_model);
return;
}
const providerModels = modelOptions
.filter((group) => group.options[0]?.provider === provider)
.flatMap((group) => group.options);
@@ -604,7 +611,7 @@ export const SwitchModelModal = ({
setModel(preferredModel);
}
}
}, [provider, modelOptions, loadingModels, model, isCustomModel, userClearedModel]);
}, [provider, modelOptions, loadingModels, model, isCustomModel, userClearedModel, activeProvidersList]);
// Handle model selection change
const handleModelChange = (newValue: unknown) => {