mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 14:30:42 +00:00
fix: canonicalize gemini onboarding model keys
This commit is contained in:
@@ -14,6 +14,7 @@ Docs: https://docs.openclaw.ai
|
||||
- Google/Gemini: normalize retired `google/gemini-3-pro-preview` and `google-gemini-cli/gemini-3-pro-preview` selections to `google/gemini-3.1-pro-preview` before they are written to model config.
|
||||
- Google/Gemini: emit canonical `google/gemini-3.1-pro-preview` ids from configured provider catalog rows so model list and selection paths can test Gemini 3.1 instead of retired Gemini 3 Pro.
|
||||
- Google/Gemini: normalize nested proxy-provider catalog ids like `google/gemini-3-pro-preview` to `google/gemini-3.1-pro-preview`, so Kilo-style configured catalogs test Gemini 3.1 instead of the retired Gemini 3 Pro id.
|
||||
- Google/Gemini: canonicalize provider-onboarding model alias maps so setup flows preserve settings under `google/gemini-3.1-pro-preview` instead of re-emitting retired Gemini 3 Pro config keys.
|
||||
- Amazon Bedrock: support `serviceTier` parameter for Bedrock models, configurable via `agents.defaults.params.serviceTier` or per-model in `agents.defaults.models`. Valid values: `default`, `flex`, `priority`, `reserved`. (#64512) Thanks @mobilinkd.
|
||||
- Control UI: read the Quick Settings exec policy badge from `tools.exec.security` instead of the non-schema `agents.defaults.exec.security` path, so configured `full`/`deny` values render accurately. Fixes #78311. Thanks @FriedBack.
|
||||
- Control UI/usage: add transcript-backed historical lineage rollups for rotated logical sessions, with current-instance vs historical-lineage scope controls and long-range presets so usage history stays visible after restarts and updates. Fixes #50701. Thanks @dev-gideon-llc and @BunsDev.
|
||||
|
||||
@@ -94,6 +94,42 @@ describe("onboard auth provider config merges", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes retired Google agent model keys when adding provider models", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
defaults: {
|
||||
models: {
|
||||
"google/gemini-3-pro-preview": {
|
||||
alias: "Gemini",
|
||||
params: { thinkingLevel: "high" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const next = applyProviderConfigWithDefaultModels(cfg, {
|
||||
agentModels: {
|
||||
"google/gemini-3.1-pro-preview": {
|
||||
params: { serviceTier: "standard" },
|
||||
},
|
||||
},
|
||||
providerId: "custom",
|
||||
api: "openai-completions",
|
||||
baseUrl: "https://new.example.com/v1",
|
||||
defaultModels: [makeModel("model-b")],
|
||||
defaultModelId: "model-b",
|
||||
});
|
||||
|
||||
expect(next.agents?.defaults?.models).toEqual({
|
||||
"google/gemini-3.1-pro-preview": {
|
||||
alias: "Gemini",
|
||||
params: { thinkingLevel: "high", serviceTier: "standard" },
|
||||
},
|
||||
});
|
||||
expect(next.agents?.defaults?.models).not.toHaveProperty("google/gemini-3-pro-preview");
|
||||
});
|
||||
|
||||
it("merges model catalogs without duplicating existing model ids", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
models: {
|
||||
@@ -150,6 +186,19 @@ describe("onboard auth provider config merges", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes retired Google alias presets before emitting config", () => {
|
||||
expect(
|
||||
withAgentModelAliases(
|
||||
{
|
||||
"google/gemini-3-pro-preview": { alias: "Pinned" },
|
||||
},
|
||||
[{ modelRef: "google/gemini-3-pro-preview", alias: "Preset" }],
|
||||
),
|
||||
).toEqual({
|
||||
"google/gemini-3.1-pro-preview": { alias: "Pinned" },
|
||||
});
|
||||
});
|
||||
|
||||
it("applies default-model presets with alias and primary model", () => {
|
||||
const next = applyProviderConfigWithDefaultModelPreset(
|
||||
{
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
|
||||
import { ensureStaticModelAllowlistEntry } from "../agents/model-allowlist-entry.js";
|
||||
import { findNormalizedProviderKey } from "../agents/provider-id.js";
|
||||
import { normalizeAgentModelRefForConfig } from "../config/model-input.js";
|
||||
import {
|
||||
normalizeAgentModelMapForConfig,
|
||||
normalizeAgentModelRefForConfig,
|
||||
} from "../config/model-input.js";
|
||||
import type { AgentModelEntryConfig } from "../config/types.agent-defaults.js";
|
||||
import type {
|
||||
ModelApi,
|
||||
@@ -165,12 +168,13 @@ export function withAgentModelAliases(
|
||||
existing: Record<string, AgentModelEntryConfig> | undefined,
|
||||
aliases: readonly AgentModelAliasEntry[],
|
||||
): Record<string, AgentModelEntryConfig> {
|
||||
const next = { ...existing };
|
||||
const next = normalizeAgentModelMapForConfig({ ...existing });
|
||||
for (const entry of aliases) {
|
||||
const normalized = normalizeAgentModelAliasEntry(entry);
|
||||
next[normalized.modelRef] = {
|
||||
...next[normalized.modelRef],
|
||||
...(normalized.alias ? { alias: next[normalized.modelRef]?.alias ?? normalized.alias } : {}),
|
||||
const modelRef = normalizeAgentModelRefForConfig(normalized.modelRef);
|
||||
next[modelRef] = {
|
||||
...next[modelRef],
|
||||
...(normalized.alias ? { alias: next[modelRef]?.alias ?? normalized.alias } : {}),
|
||||
};
|
||||
}
|
||||
return next;
|
||||
@@ -183,10 +187,10 @@ export function applyOnboardAuthAgentModelsAndProviders(
|
||||
providers: Record<string, ModelProviderConfig>;
|
||||
},
|
||||
): OpenClawConfig {
|
||||
const mergedAgentModels = {
|
||||
const mergedAgentModels = normalizeAgentModelMapForConfig({
|
||||
...cfg.agents?.defaults?.models,
|
||||
...params.agentModels,
|
||||
};
|
||||
});
|
||||
return {
|
||||
...cfg,
|
||||
agents: {
|
||||
|
||||
Reference in New Issue
Block a user