


























@@ -5,6 +5,7 @@ import { createWarnLogCapture } from "../logging/test-helpers/warn-log-capture.j
55import { migrateLegacyRuntimeModelRef } from "./model-runtime-aliases.js";
66import {
77buildAllowedModelSet,
8+buildConfiguredModelCatalog,
89inferUniqueProviderFromConfiguredModels,
910parseModelRef,
1011buildModelAliasIndex,
@@ -689,6 +690,25 @@ describe("model-selection", () => {
689690).toBe("qwen-dashscope");
690691});
691692693+it("infers Google provider from canonicalized configured provider catalogs", () => {
694+const cfg = {
695+models: {
696+providers: {
697+google: {
698+models: [{ id: "gemini-3-pro-preview" }],
699+},
700+},
701+},
702+} as unknown as OpenClawConfig;
703+704+expect(
705+inferUniqueProviderFromConfiguredModels({
706+ cfg,
707+model: "gemini-3.1-pro-preview",
708+}),
709+).toBe("google");
710+});
711+692712it("returns undefined when provider catalog matches are ambiguous", () => {
693713const cfg = {
694714models: {
@@ -712,6 +732,33 @@ describe("model-selection", () => {
712732});
713733});
714734735+describe("buildConfiguredModelCatalog", () => {
736+it("emits canonical Google Gemini 3.1 provider model ids", () => {
737+const cfg = {
738+models: {
739+providers: {
740+google: {
741+models: [
742+{
743+id: "gemini-3-pro-preview",
744+name: "Gemini 3 Pro",
745+},
746+],
747+},
748+},
749+},
750+} as unknown as OpenClawConfig;
751+752+expect(buildConfiguredModelCatalog({ cfg })).toContainEqual(
753+expect.objectContaining({
754+provider: "google",
755+id: "gemini-3.1-pro-preview",
756+name: "Gemini 3 Pro",
757+}),
758+);
759+});
760+});
761+715762describe("buildModelAliasIndex", () => {
716763it("should build alias index from config", () => {
717764const cfg: Partial<OpenClawConfig> = {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。