fix: resolve custom provider env markers · openclaw/openclaw@8831754
rendrag-git
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -199,6 +199,62 @@ describe("models-config provider auth provenance", () => {
|
199 | 199 | }); |
200 | 200 | }); |
201 | 201 | |
| 202 | +it("resolves custom configured env markers for catalog discovery", () => { |
| 203 | +const auth = createProviderApiKeyResolver( |
| 204 | +{ |
| 205 | +MY_VLLM_KEY: "resolved-vllm-key", |
| 206 | +} as NodeJS.ProcessEnv, |
| 207 | +{ |
| 208 | +version: 1, |
| 209 | +profiles: {}, |
| 210 | +}, |
| 211 | +{ |
| 212 | +models: { |
| 213 | +providers: { |
| 214 | +vllm: { |
| 215 | +baseUrl: "http://127.0.0.1:8000/v1", |
| 216 | +apiKey: "${MY_VLLM_KEY}", |
| 217 | +api: "openai-completions", |
| 218 | +models: [], |
| 219 | +}, |
| 220 | +}, |
| 221 | +}, |
| 222 | +}, |
| 223 | +); |
| 224 | + |
| 225 | +expect(auth("vllm")).toEqual({ |
| 226 | +apiKey: "MY_VLLM_KEY", |
| 227 | +discoveryApiKey: "resolved-vllm-key", |
| 228 | +}); |
| 229 | +}); |
| 230 | + |
| 231 | +it("does not send missing custom env markers as catalog discovery keys", () => { |
| 232 | +const auth = createProviderApiKeyResolver( |
| 233 | +{} as NodeJS.ProcessEnv, |
| 234 | +{ |
| 235 | +version: 1, |
| 236 | +profiles: {}, |
| 237 | +}, |
| 238 | +{ |
| 239 | +models: { |
| 240 | +providers: { |
| 241 | +vllm: { |
| 242 | +baseUrl: "http://127.0.0.1:8000/v1", |
| 243 | +apiKey: "MY_VLLM_KEY", |
| 244 | +api: "openai-completions", |
| 245 | +models: [], |
| 246 | +}, |
| 247 | +}, |
| 248 | +}, |
| 249 | +}, |
| 250 | +); |
| 251 | + |
| 252 | +expect(auth("vllm")).toEqual({ |
| 253 | +apiKey: undefined, |
| 254 | +discoveryApiKey: undefined, |
| 255 | +}); |
| 256 | +}); |
| 257 | + |
202 | 258 | it("preserves shared non-secret synthetic auth markers from provider hooks", () => { |
203 | 259 | mockedResolveProviderSyntheticAuthWithPlugin.mockReturnValue({ |
204 | 260 | apiKey: CUSTOM_LOCAL_AUTH_MARKER, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。