Skip to content

Commit 61cbd90

Browse files
committed
fix(minimax): preserve secret references during onboarding
1 parent 9b8bd14 commit 61cbd90

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎extensions/minimax/onboard.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ describe("minimax onboard", () => {
107107
MiniMax: {
108108
baseUrl: "https://api.minimax.io/anthropic",
109109
api: "anthropic-messages",
110+
apiKey: { source: "env", provider: "default", id: "MINIMAX_API_KEY" },
110111
timeoutSeconds: 900,
111112
models: [buildMinimaxApiModelDefinition("MiniMax-M2.7")],
112113
},
@@ -115,6 +116,11 @@ describe("minimax onboard", () => {
115116
});
116117

117118
expect(Object.keys(cfg.models?.providers ?? {})).toEqual(["minimax"]);
119+
expect(cfg.models?.providers?.minimax?.apiKey).toEqual({
120+
source: "env",
121+
provider: "default",
122+
id: "MINIMAX_API_KEY",
123+
});
118124
expect(cfg.models?.providers?.minimax?.timeoutSeconds).toBe(900);
119125
expect(cfg.models?.providers?.minimax?.models.map((model) => model.id)).toEqual([
120126
"MiniMax-M2.7",

‎extensions/minimax/onboard.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ function applyMinimaxApiProviderConfigWithBaseUrl(
3939
baseUrl: params.baseUrl,
4040
models: [],
4141
};
42-
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
43-
const normalizedApiKey = resolvedApiKey?.trim() === "minimax" ? "" : resolvedApiKey;
42+
const preservedApiKey =
43+
typeof existingApiKey === "string"
44+
? existingApiKey.trim() === "" || existingApiKey.trim() === "minimax"
45+
? undefined
46+
: existingApiKey
47+
: existingApiKey;
4448
providers[params.providerId] = {
4549
...existingProviderRest,
4650
baseUrl: params.baseUrl,
4751
api: "anthropic-messages",
4852
authHeader: true,
49-
...(normalizedApiKey?.trim() ? { apiKey: normalizedApiKey } : {}),
53+
...(preservedApiKey ? { apiKey: preservedApiKey } : {}),
5054
models: mergedModels.length > 0 ? mergedModels : [apiModel],
5155
};
5256

0 commit comments

Comments
 (0)