Ver código fonte

fix(vscode-lm) fix api-config profile update for vscode lm

sam hoang 11 meses atrás
pai
commit
3ecc0e66ec
1 arquivos alterados com 9 adições e 5 exclusões
  1. 9 5
      webview-ui/src/components/settings/ApiOptions.tsx

+ 9 - 5
webview-ui/src/components/settings/ApiOptions.tsx

@@ -639,12 +639,16 @@ const ApiOptions = ({ apiErrorMessage, modelIdErrorMessage }: ApiOptionsProps) =
 									`${apiConfiguration.vsCodeLmModelSelector.vendor ?? ""}/${apiConfiguration.vsCodeLmModelSelector.family ?? ""}` :
 									`${apiConfiguration.vsCodeLmModelSelector.vendor ?? ""}/${apiConfiguration.vsCodeLmModelSelector.family ?? ""}` :
 									""}
 									""}
 								onChange={(value: unknown) => {
 								onChange={(value: unknown) => {
-									const valueStr = (value as DropdownOption).value;
+									const valueStr = (value as DropdownOption)?.value;
+									if (!valueStr) {
+										return
+									}
 									const [vendor, family] = valueStr.split('/');
 									const [vendor, family] = valueStr.split('/');
-									setApiConfiguration({
-										...apiConfiguration,
-										vsCodeLmModelSelector: valueStr ? { vendor, family } : undefined
-									});
+									handleInputChange("vsCodeLmModelSelector")({
+										target: {
+											value: { vendor, family } 
+										}
+									})
 								}}
 								}}
 								style={{ width: "100%" }}
 								style={{ width: "100%" }}
 								options={[
 								options={[