fix: clean up models-config provider normalization

This commit is contained in:
Peter Steinberger
2026-01-12 17:13:45 +00:00
parent 1b2c1545a0
commit fd1e959c2d
2 changed files with 6 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ const MOONSHOT_DEFAULT_COST = {
function normalizeApiKeyConfig(value: string): string {
const trimmed = value.trim();
const match = /^\$\{([A-Z0-9_]+)\}$/.exec(trimmed);
return match ? match[1]! : trimmed;
return match ? match[1] : trimmed;
}
function resolveEnvApiKeyVarName(provider: string): string | undefined {
@@ -194,4 +194,3 @@ export function resolveImplicitProviders(params: {
return providers;
}

View File

@@ -243,7 +243,11 @@ describe("models config", () => {
const parsed = JSON.parse(raw) as {
providers: Record<
string,
{ baseUrl?: string; apiKey?: string; models?: Array<{ id: string }> }
{
baseUrl?: string;
apiKey?: string;
models?: Array<{ id: string }>;
}
>;
};
expect(parsed.providers.minimax?.baseUrl).toBe(