|
1 | 1 | import type { OpenClawConfig } from "../config/types.openclaw.js"; |
| 2 | +import { normalizeGooglePreviewModelId } from "../plugin-sdk/provider-model-id-normalize.js"; |
2 | 3 | import { |
3 | 4 | normalizeLowercaseStringOrEmpty, |
4 | 5 | normalizeOptionalLowercaseString, |
5 | 6 | } from "../shared/string-coerce.js"; |
6 | 7 | import { liveProvidersShareOwningPlugin } from "./live-provider-owner.js"; |
7 | | -import { normalizeStaticProviderModelId } from "./model-ref-shared.js"; |
8 | 8 | import { normalizeProviderId } from "./provider-id.js"; |
9 | 9 | |
10 | 10 | type ModelTarget = { |
@@ -13,6 +13,15 @@ type ModelTarget = {
|
13 | 13 | modelId: string; |
14 | 14 | }; |
15 | 15 | |
| 16 | +const GOOGLE_LIVE_TARGET_PROVIDERS = new Set(["google", "google-gemini-cli", "google-vertex"]); |
| 17 | + |
| 18 | +function normalizeLiveTargetModelId(provider: string, modelId: string): string { |
| 19 | +const trimmed = modelId.trim(); |
| 20 | +return GOOGLE_LIVE_TARGET_PROVIDERS.has(provider) |
| 21 | + ? normalizeGooglePreviewModelId(trimmed) |
| 22 | + : trimmed; |
| 23 | +} |
| 24 | + |
16 | 25 | function normalizeCsvSet(values: Set<string> | null): Set<string> | null { |
17 | 26 | if (!values) { |
18 | 27 | return null; |
@@ -42,7 +51,7 @@ function parseModelTarget(raw: string): ModelTarget | null {
|
42 | 51 | } |
43 | 52 | const provider = normalizeProviderId(trimmed.slice(0, slash)); |
44 | 53 | const modelId = normalizeLowercaseStringOrEmpty( |
45 | | -normalizeStaticProviderModelId(provider, trimmed.slice(slash + 1)), |
| 54 | +normalizeLiveTargetModelId(provider, trimmed.slice(slash + 1)), |
46 | 55 | ); |
47 | 56 | if (!provider || !modelId) { |
48 | 57 | return null; |
|