11import { useCallback } from "react"
22import { VSCodeTextField , VSCodeDropdown , VSCodeOption } from "@vscode/webview-ui-toolkit/react"
33
4- import type { ProviderSettings } from "@roo-code/types"
4+ import { zaiApiLineConfigs , zaiApiLineSchema , type ProviderSettings } from "@roo-code/types"
55
66import { useAppTranslation } from "@src/i18n/TranslationContext"
77import { VSCodeButtonLink } from "@src/components/common/VSCodeButtonLink"
@@ -33,15 +33,17 @@ export const ZAi = ({ apiConfiguration, setApiConfigurationField }: ZAiProps) =>
3333 < div >
3434 < label className = "block font-medium mb-1" > { t ( "settings:providers.zaiEntrypoint" ) } </ label >
3535 < VSCodeDropdown
36- value = { apiConfiguration . zaiApiLine || "international" }
36+ value = { apiConfiguration . zaiApiLine || zaiApiLineSchema . enum . international_coding }
3737 onChange = { handleInputChange ( "zaiApiLine" ) }
3838 className = { cn ( "w-full" ) } >
39- < VSCodeOption value = "international" className = "p-2" >
40- api.z.ai
41- </ VSCodeOption >
42- < VSCodeOption value = "china" className = "p-2" >
43- open.bigmodel.cn
44- </ VSCodeOption >
39+ { zaiApiLineSchema . options . map ( ( zaiApiLine ) => {
40+ const config = zaiApiLineConfigs [ zaiApiLine ]
41+ return (
42+ < VSCodeOption key = { zaiApiLine } value = { zaiApiLine } className = "p-2" >
43+ { config . name } ({ config . baseUrl } )
44+ </ VSCodeOption >
45+ )
46+ } ) }
4547 </ VSCodeDropdown >
4648 < div className = "text-xs text-vscode-descriptionForeground mt-1" >
4749 { t ( "settings:providers.zaiEntrypointDescription" ) }
@@ -62,7 +64,7 @@ export const ZAi = ({ apiConfiguration, setApiConfigurationField }: ZAiProps) =>
6264 { ! apiConfiguration ?. zaiApiKey && (
6365 < VSCodeButtonLink
6466 href = {
65- apiConfiguration . zaiApiLine === "china"
67+ zaiApiLineConfigs [ apiConfiguration . zaiApiLine ?? "international_coding" ] . isChina
6668 ? "https://open.bigmodel.cn/console/overview"
6769 : "https://z.ai/manage-apikey/apikey-list"
6870 }
0 commit comments