mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-11 12:09:03 +00:00
fix: narrow legacy GLMT base URL normalization (#1376)
* fix: narrow legacy glmt base url normalization * style: apply prettier formatting
This commit is contained in:
1 parent
b0a754179c
commit
781c84b04b
2 files changed
+4
-5
No files matched your search
@@ -25,11 +25,7 @@ export function isLegacyGlmtBaseUrl(baseUrl: string | null | undefined): boolean
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return normalized === LEGACY_GLMT_BASE_URL || normalized.includes('/api/coding/paas/v4');
|
||||||
normalized === LEGACY_GLMT_BASE_URL ||
|
|
||||||
normalized.includes('/api/coding/paas/v4') ||
|
|
||||||
normalized.endsWith('/chat/completions')
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function normalizeDeprecatedGlmtEnv(env: Record<string, string>): GlmtNormalizationResult {
|
export function normalizeDeprecatedGlmtEnv(env: Record<string, string>): GlmtNormalizationResult {
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ describe('glmt deprecation helpers', () => {
|
|||||||
expect(isLegacyGlmtBaseUrl('https://api.z.ai/api/coding/paas/v4/chat/completions/')).toBe(
|
expect(isLegacyGlmtBaseUrl('https://api.z.ai/api/coding/paas/v4/chat/completions/')).toBe(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
expect(isLegacyGlmtBaseUrl('https://private.example.internal/v1/chat/completions')).toBe(
|
||||||
|
false
|
||||||
|
);
|
||||||
expect(isLegacyGlmtBaseUrl('https://api.z.ai/api/anthropic')).toBe(false);
|
expect(isLegacyGlmtBaseUrl('https://api.z.ai/api/anthropic')).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user