mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-25 23:47:20 +00:00
fix: correct gemini flash model id
This commit is contained in:
@@ -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-"));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ const DEFAULT_MODEL_ALIASES: Readonly<Record<string, string>> = {
|
||||
|
||||
// Google Gemini (3.x are preview ids in the catalog)
|
||||
gemini: "google/gemini-3.1-pro-preview",
|
||||
"gemini-flash": "google/gemini-3.1-flash-preview",
|
||||
"gemini-flash": "google/gemini-3-flash-preview",
|
||||
};
|
||||
|
||||
const DEFAULT_MODEL_COST: ModelDefinitionConfig["cost"] = {
|
||||
|
||||
@@ -68,7 +68,7 @@ describe("applyModelDefaults", () => {
|
||||
defaults: {
|
||||
models: {
|
||||
"google/gemini-3.1-pro-preview": { alias: "" },
|
||||
"google/gemini-3.1-flash-preview": {},
|
||||
"google/gemini-3-flash-preview": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -77,7 +77,7 @@ describe("applyModelDefaults", () => {
|
||||
const next = applyModelDefaults(cfg);
|
||||
|
||||
expect(next.agents?.defaults?.models?.["google/gemini-3.1-pro-preview"]?.alias).toBe("");
|
||||
expect(next.agents?.defaults?.models?.["google/gemini-3.1-flash-preview"]?.alias).toBe(
|
||||
expect(next.agents?.defaults?.models?.["google/gemini-3-flash-preview"]?.alias).toBe(
|
||||
"gemini-flash",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user