fix(api-profiles): correct z.AI China preset URL and rename provider presets (#1500)

* fix(api-profiles): correct z.AI China preset URL and rename provider presets

- Fix glm-cn preset to use Anthropic-compatible endpoint
- Change URL from /api/paas/v4 to /api/anthropic
- Rename preset IDs from glm-* to zai-* (z.AI is provider, GLM is model)
- Update translations in EN and FR
- Update tests and documentation
- Fix test fixtures in AuthStatusIndicator.test.tsx
- Fix test mock data in usage-monitor.test.ts
- Fix JSDoc examples in usage-monitor.ts and provider-detection.ts

Fixes ACS-397

* fix: address PR review feedback (CodeRabbit + Gemini)

- Rename glmGlobalOption to zaiGlobalOption for clarity
- Translate French values: Global→Mondial, China→Chine

Addresses feedback from:
- CodeRabbit: Variable naming should match z.AI label
- Gemini Code Assist: French translations incomplete

---------

Co-authored-by: StillKnotKnown <stillknotknown@users.noreply.github.com>
This commit is contained in:
StillKnotKnown
2026-01-26 13:41:26 +02:00
committed by GitHub
parent 8576754a12
commit 05cf0a5163
9 changed files with 17 additions and 17 deletions
@@ -982,7 +982,7 @@ describe('usage-monitor', () => {
profiles: [{
id: 'zhipu-profile-1',
name: 'ZHIPU Profile',
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
baseUrl: 'https://open.bigmodel.cn/api/anthropic',
apiKey: 'zhipu-api-key'
}],
activeProfileId: 'zhipu-profile-1',
@@ -158,7 +158,7 @@ export function getUsageEndpoint(provider: ApiProvider, baseUrl: string): string
* @example
* detectProvider('https://api.anthropic.com') // returns 'anthropic'
* detectProvider('https://api.z.ai/api/anthropic') // returns 'zai'
* detectProvider('https://open.bigmodel.cn/api/paas/v4') // returns 'zhipu'
* detectProvider('https://open.bigmodel.cn/api/anthropic') // returns 'zhipu'
* detectProvider('https://unknown.com/api') // returns 'unknown'
*/
export function detectProvider(baseUrl: string): ApiProvider {
@@ -111,7 +111,7 @@ const testProfiles: APIProfile[] = [
{
id: 'profile-4',
name: 'ZHIPU China',
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
baseUrl: 'https://open.bigmodel.cn/api/anthropic',
apiKey: 'zhipu-key-5678',
models: undefined,
createdAt: Date.now(),
@@ -282,11 +282,11 @@ describe('ProfileEditDialog - Create Mode', () => {
const presetTrigger = screen.getByLabelText(/preset/i);
fireEvent.keyDown(presetTrigger, { key: 'ArrowDown', code: 'ArrowDown' });
const glmGlobalOption = await screen.findByRole('option', { name: 'GLM (Global)' });
fireEvent.click(glmGlobalOption);
const zaiGlobalOption = await screen.findByRole('option', { name: 'z.AI (Global)' });
fireEvent.click(zaiGlobalOption);
expect(screen.getByLabelText(/base url/i)).toHaveValue('https://api.z.ai/api/anthropic');
expect(screen.getByLabelText(/name/i)).toHaveValue('GLM (Global)');
expect(screen.getByLabelText(/name/i)).toHaveValue('z.AI (Global)');
});
it('should not overwrite name when applying a preset', async () => {
@@ -21,13 +21,13 @@ export const API_PROVIDER_PRESETS: readonly ApiProviderPreset[] = [
labelKey: 'settings:apiProfiles.presets.groq'
},
{
id: 'glm-global',
id: 'zai-global',
baseUrl: 'https://api.z.ai/api/anthropic',
labelKey: 'settings:apiProfiles.presets.glmGlobal'
labelKey: 'settings:apiProfiles.presets.zaiGlobal'
},
{
id: 'glm-cn',
baseUrl: 'https://open.bigmodel.cn/api/paas/v4',
labelKey: 'settings:apiProfiles.presets.glmChina'
id: 'zai-cn',
baseUrl: 'https://open.bigmodel.cn/api/anthropic',
labelKey: 'settings:apiProfiles.presets.zaiChina'
}
];
@@ -54,8 +54,8 @@
"anthropic": "Anthropic",
"openrouter": "OpenRouter",
"groq": "Groq",
"glmGlobal": "GLM (Global)",
"glmChina": "GLM (China)"
"zaiGlobal": "z.AI (Global)",
"zaiChina": "z.AI (China)"
},
"fields": {
"name": "Name",
@@ -54,8 +54,8 @@
"anthropic": "Anthropic",
"openrouter": "OpenRouter",
"groq": "Groq",
"glmGlobal": "GLM (Global)",
"glmChina": "GLM (China)"
"zaiGlobal": "z.AI (Mondial)",
"zaiChina": "z.AI (Chine)"
},
"fields": {
"name": "Nom",
@@ -38,7 +38,7 @@ describe('provider-detection', () => {
describe('ZHIPU provider', () => {
it('should detect ZHIPU from open.bigmodel.cn', () => {
const result = detectProvider('https://open.bigmodel.cn/api/paas/v4');
const result = detectProvider('https://open.bigmodel.cn/api/anthropic');
expect(result).toBe('zhipu');
});
@@ -47,7 +47,7 @@ const PROVIDER_PATTERNS: readonly ProviderPattern[] = [
* @example
* detectProvider('https://api.anthropic.com') // returns 'anthropic'
* detectProvider('https://api.z.ai/api/anthropic') // returns 'zai'
* detectProvider('https://open.bigmodel.cn/api/paas/v4') // returns 'zhipu'
* detectProvider('https://open.bigmodel.cn/api/anthropic') // returns 'zhipu'
* detectProvider('https://unknown.com/api') // returns 'unknown'
*/
export function detectProvider(baseUrl: string): ApiProvider {