-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(zai): consolidate to two coding entrypoints and update endpoints/tests/UI #8162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7bc7291
3ad654d
ea48d53
023ea9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,14 +15,14 @@ import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider" | |||||||||||
|
|
||||||||||||
| export class ZAiHandler extends BaseOpenAiCompatibleProvider<InternationalZAiModelId | MainlandZAiModelId> { | ||||||||||||
| constructor(options: ApiHandlerOptions) { | ||||||||||||
| const isChina = zaiApiLineConfigs[options.zaiApiLine ?? "international_coding"].isChina | ||||||||||||
| const isChina = zaiApiLineConfigs[options.zaiApiLine ?? "international"].isChina | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this removes existing enum values ('international_coding' and 'china_coding'), users with existing configurations using these values might encounter runtime issues. Could we consider adding a migration handler here?
Suggested change
This would gracefully handle legacy configurations. |
||||||||||||
| const models = isChina ? mainlandZAiModels : internationalZAiModels | ||||||||||||
| const defaultModelId = isChina ? mainlandZAiDefaultModelId : internationalZAiDefaultModelId | ||||||||||||
|
|
||||||||||||
| super({ | ||||||||||||
| ...options, | ||||||||||||
| providerName: "Z AI", | ||||||||||||
| baseURL: zaiApiLineConfigs[options.zaiApiLine ?? "international_coding"].baseUrl, | ||||||||||||
| baseURL: zaiApiLineConfigs[options.zaiApiLine ?? "international"].baseUrl, | ||||||||||||
| apiKey: options.zaiApiKey ?? "not-provided", | ||||||||||||
| defaultProviderModelId: defaultModelId, | ||||||||||||
| providerModels: models, | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ export const ZAi = ({ apiConfiguration, setApiConfigurationField }: ZAiProps) => | |
| <div> | ||
| <label className="block font-medium mb-1">{t("settings:providers.zaiEntrypoint")}</label> | ||
| <VSCodeDropdown | ||
| value={apiConfiguration.zaiApiLine || zaiApiLineSchema.enum.international_coding} | ||
| value={apiConfiguration.zaiApiLine || zaiApiLineSchema.enum.international} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job updating the default value here. This ensures the UI properly reflects the new simplified options. |
||
| onChange={handleInputChange("zaiApiLine")} | ||
| className={cn("w-full")}> | ||
| {zaiApiLineSchema.options.map((zaiApiLine) => { | ||
|
|
@@ -64,7 +64,7 @@ export const ZAi = ({ apiConfiguration, setApiConfigurationField }: ZAiProps) => | |
| {!apiConfiguration?.zaiApiKey && ( | ||
| <VSCodeButtonLink | ||
| href={ | ||
| zaiApiLineConfigs[apiConfiguration.zaiApiLine ?? "international_coding"].isChina | ||
| zaiApiLineConfigs[apiConfiguration.zaiApiLine ?? "international"].isChina | ||
| ? "https://open.bigmodel.cn/console/overview" | ||
| : "https://z.ai/manage-apikey/apikey-list" | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the naming convention intentional where the enum uses lowercase 'international' and 'china' but the display names are 'International' and 'China'? Just confirming this is the desired pattern - it's consistent throughout, which is good.