fix: clean up models-config provider normalization
This commit is contained in:
@@ -34,7 +34,7 @@ const MOONSHOT_DEFAULT_COST = {
|
|||||||
function normalizeApiKeyConfig(value: string): string {
|
function normalizeApiKeyConfig(value: string): string {
|
||||||
const trimmed = value.trim();
|
const trimmed = value.trim();
|
||||||
const match = /^\$\{([A-Z0-9_]+)\}$/.exec(trimmed);
|
const match = /^\$\{([A-Z0-9_]+)\}$/.exec(trimmed);
|
||||||
return match ? match[1]! : trimmed;
|
return match ? match[1] : trimmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveEnvApiKeyVarName(provider: string): string | undefined {
|
function resolveEnvApiKeyVarName(provider: string): string | undefined {
|
||||||
@@ -194,4 +194,3 @@ export function resolveImplicitProviders(params: {
|
|||||||
|
|
||||||
return providers;
|
return providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,11 @@ describe("models config", () => {
|
|||||||
const parsed = JSON.parse(raw) as {
|
const parsed = JSON.parse(raw) as {
|
||||||
providers: Record<
|
providers: Record<
|
||||||
string,
|
string,
|
||||||
{ baseUrl?: string; apiKey?: string; models?: Array<{ id: string }> }
|
{
|
||||||
|
baseUrl?: string;
|
||||||
|
apiKey?: string;
|
||||||
|
models?: Array<{ id: string }>;
|
||||||
|
}
|
||||||
>;
|
>;
|
||||||
};
|
};
|
||||||
expect(parsed.providers.minimax?.baseUrl).toBe(
|
expect(parsed.providers.minimax?.baseUrl).toBe(
|
||||||
|
|||||||
Reference in New Issue
Block a user