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 <[email protected]>
This commit is contained in:
StillKnotKnown
2026-02-09 12:31:33 +02:00
committed by StillKnotKnown
co-authored by StillKnotKnown
parent f9bd6a1e3d
commit e638f820c8
5 changed files with 5 additions and 5 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(),
@@ -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 {