mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 18:33:37 +00:00
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
// Keep model ID normalization dependency-free so config parsing and other
|
|
// startup-only paths do not pull in provider discovery or plugin loading.
|
|
export function normalizeGoogleModelId(id: string): string {
|
|
if (id === "gemini-3-pro") {
|
|
return "gemini-3-pro-preview";
|
|
}
|
|
if (id === "gemini-3-flash") {
|
|
return "gemini-3-flash-preview";
|
|
}
|
|
if (id === "gemini-3.1-pro") {
|
|
return "gemini-3.1-pro-preview";
|
|
}
|
|
if (id === "gemini-3.1-flash-lite") {
|
|
return "gemini-3.1-flash-lite-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;
|
|
}
|
|
|
|
export function normalizeXaiModelId(id: string): string {
|
|
if (id === "grok-4-fast-reasoning") {
|
|
return "grok-4-fast";
|
|
}
|
|
if (id === "grok-4-1-fast-reasoning") {
|
|
return "grok-4-1-fast";
|
|
}
|
|
if (id === "grok-4.20-experimental-beta-0304-reasoning") {
|
|
return "grok-4.20-beta-latest-reasoning";
|
|
}
|
|
if (id === "grok-4.20-experimental-beta-0304-non-reasoning") {
|
|
return "grok-4.20-beta-latest-non-reasoning";
|
|
}
|
|
if (id === "grok-4.20-reasoning") {
|
|
return "grok-4.20-beta-latest-reasoning";
|
|
}
|
|
if (id === "grok-4.20-non-reasoning") {
|
|
return "grok-4.20-beta-latest-non-reasoning";
|
|
}
|
|
return id;
|
|
}
|