fix: correct gemini flash model id

This commit is contained in:
Peter Steinberger
2026-03-08 02:32:49 +00:00
parent 46008178d1
commit 100da9f45c
10 changed files with 26 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ import { join } from "node:path";
import { describe, expect, it } from "vitest";
import {
normalizeAntigravityModelId,
normalizeGoogleModelId,
normalizeProviders,
type ProviderConfig,
} from "./models-config.providers.js";
@@ -47,6 +48,13 @@ describe("normalizeAntigravityModelId", () => {
});
});
describe("normalizeGoogleModelId", () => {
it("maps the deprecated 3.1 flash alias to the real preview model", () => {
expect(normalizeGoogleModelId("gemini-3.1-flash")).toBe("gemini-3-flash-preview");
expect(normalizeGoogleModelId("gemini-3.1-flash-preview")).toBe("gemini-3-flash-preview");
});
});
describe("google-antigravity provider normalization", () => {
it("normalizes bare gemini pro IDs only for google-antigravity providers", () => {
const agentDir = mkdtempSync(join(tmpdir(), "openclaw-test-"));

View File

@@ -547,8 +547,11 @@ export function normalizeGoogleModelId(id: string): string {
if (id === "gemini-3.1-pro") {
return "gemini-3.1-pro-preview";
}
if (id === "gemini-3.1-flash") {
return "gemini-3.1-flash-preview";
// Preserve compatibility with earlier OpenClaw docs/config that pointed at a
// non-existent Gemini Flash preview ID. Google's current Flash text model is
// `gemini-3-flash-preview`.
if (id === "gemini-3.1-flash" || id === "gemini-3.1-flash-preview") {
return "gemini-3-flash-preview";
}
return id;
}