




























@@ -516,6 +516,57 @@ describe("resolveModel", () => {
516516expect(discoverModels).not.toHaveBeenCalled();
517517});
518518519+it("applies provider overrides to bundled static catalog rows while skipping PI discovery", async () => {
520+resolveBundledStaticCatalogModelMock.mockReturnValueOnce({
521+provider: "mistral",
522+id: "mistral-medium-3-5",
523+name: "Mistral Medium 3.5",
524+api: "openai-completions",
525+baseUrl: "https://api.mistral.ai/v1",
526+input: ["text", "image"],
527+contextWindow: 262144,
528+maxTokens: 8192,
529+});
530+const cfg = {
531+models: {
532+providers: {
533+mistral: {
534+baseUrl: "https://mistral-proxy.example.com/v1",
535+api: "openai-completions",
536+headers: { "X-Proxy": "static-fast-path" },
537+request: { proxy: { mode: "explicit-proxy", url: "http://127.0.0.1:18080" } },
538+localService: {
539+command: "/opt/mistral/start",
540+args: ["--port", "18080"],
541+healthUrl: "http://127.0.0.1:18080/health",
542+},
543+models: [],
544+},
545+},
546+},
547+} as unknown as OpenClawConfig;
548+549+const result = await resolveModelAsync("mistral", "mistral-medium-3-5", "/tmp/agent", cfg, {
550+allowBundledStaticCatalogFallback: true,
551+runtimeHooks: createRuntimeHooks(),
552+skipPiDiscovery: true,
553+});
554+const model = expectResolvedModel(result);
555+556+expect(model.baseUrl).toBe("https://mistral-proxy.example.com/v1");
557+expect(model.headers).toEqual({ "X-Proxy": "static-fast-path" });
558+expect(getModelProviderRequestTransport(model)).toEqual({
559+proxy: { mode: "explicit-proxy", url: "http://127.0.0.1:18080" },
560+});
561+expect(getModelProviderLocalService(model)).toEqual({
562+command: "/opt/mistral/start",
563+args: ["--port", "18080"],
564+healthUrl: "http://127.0.0.1:18080/health",
565+});
566+expect(discoverAuthStorage).not.toHaveBeenCalled();
567+expect(discoverModels).not.toHaveBeenCalled();
568+});
569+519570it("does not use bundled static catalog rows unless the caller opts in", async () => {
520571const result = await resolveModelAsync(
521572"mistral",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。