From 35870a1135e80d240d0d84ac5224fc5800ed3b8b Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Mon, 3 Feb 2025 13:20:26 -0500 Subject: [PATCH] feat: implement error handling for Azure AI model API interactions --- .../components/settings/AzureAiModelPicker.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/webview-ui/src/components/settings/AzureAiModelPicker.tsx b/webview-ui/src/components/settings/AzureAiModelPicker.tsx index e521003..c294024 100644 --- a/webview-ui/src/components/settings/AzureAiModelPicker.tsx +++ b/webview-ui/src/components/settings/AzureAiModelPicker.tsx @@ -246,7 +246,9 @@ const AzureAiModelPicker: React.FC = () => { onClick: () => { const apiConfig = { ...apiConfiguration, - azureAiModelConfig: azureAiModelInfoSaneDefaults, + azureAiModelConfig: { + ...azureAiModelInfoSaneDefaults, + }, } setApiConfiguration(apiConfig) onUpdateApiConfig(apiConfig) @@ -300,14 +302,12 @@ const AzureAiModelPicker: React.FC = () => { const apiConfig = { ...apiConfiguration, azureAiModelConfig: { - ...(apiConfiguration?.azureAiModelConfig || - azureAiModelInfoSaneDefaults), + ...azureAiModelInfoSaneDefaults, + ...(apiConfiguration?.azureAiModelConfig || {}), contextWindow: - e.target.value === "" - ? undefined - : isNaN(parsed) - ? azureAiModelInfoSaneDefaults.contextWindow - : parsed, + isNaN(parsed) || e.target.value === "" + ? azureAiModelInfoSaneDefaults.contextWindow + : parsed, }, } setApiConfiguration(apiConfig)