From 3ecc0e66ecc5d761b65ae3e3e40dce7b3e7e0d16 Mon Sep 17 00:00:00 2001 From: sam hoang Date: Fri, 17 Jan 2025 08:18:57 +0700 Subject: [PATCH] fix(vscode-lm) fix api-config profile update for vscode lm --- webview-ui/src/components/settings/ApiOptions.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index dfee51a..eff166b 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -639,12 +639,16 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) = `${apiConfiguration.vsCodeLmModelSelector.vendor ?? ""}/${apiConfiguration.vsCodeLmModelSelector.family ?? ""}` : ""} onChange={(value: unknown) => { - const valueStr = (value as DropdownOption).value; + const valueStr = (value as DropdownOption)?.value; + if (!valueStr) { + return + } const [vendor, family] = valueStr.split('/'); - setApiConfiguration({ - ...apiConfiguration, - vsCodeLmModelSelector: valueStr ? { vendor, family } : undefined - }); + handleInputChange("vsCodeLmModelSelector")({ + target: { + value: { vendor, family } + } + }) }} style={{ width: "100%" }} options={[