






















@@ -1,6 +1,7 @@
11import { isDeepStrictEqual } from "node:util";
22import { isRecord } from "../utils.js";
33import { applyMergePatch } from "./merge-patch.js";
4+import { normalizeAgentModelRefForConfig } from "./model-input.js";
45import { isBlockedObjectKey } from "./prototype-keys.js";
56import type { OpenClawConfig } from "./types.js";
67@@ -153,6 +154,23 @@ function setPathValueCreatingParents(value: unknown, path: string[], nextValue:
153154};
154155}
155156157+function deletePathValue(value: unknown, path: string[]): unknown {
158+if (path.length === 0 || !isRecord(value)) {
159+return value;
160+}
161+const [head, ...tail] = path;
162+if (!Object.prototype.hasOwnProperty.call(value, head)) {
163+return value;
164+}
165+const next: Record<string, unknown> = { ...value };
166+if (tail.length === 0) {
167+delete next[head];
168+return next;
169+}
170+next[head] = deletePathValue(value[head], tail);
171+return next;
172+}
173+156174function preserveSourceValueAtPath(params: {
157175persistedCandidate: unknown;
158176sourceConfig: unknown;
@@ -211,8 +229,16 @@ function preserveAuthoredAgentParams(params: {
211229if (!isRecord(modelEntry) || !Object.prototype.hasOwnProperty.call(modelEntry, "params")) {
212230continue;
213231}
214-const modelPath = ["agents", "defaults", "models", modelId];
232+const modelPath = [
233+"agents",
234+"defaults",
235+"models",
236+normalizeAgentModelRefForConfig(modelId) || modelId,
237+];
215238const paramsPath = [...modelPath, "params"];
239+if (modelPath.at(-1) !== modelId) {
240+next = deletePathValue(next, ["agents", "defaults", "models", modelId]);
241+}
216242if (getPathValue(next, modelPath) === undefined) {
217243next = preserveSourceValueAtPath({
218244 ...params,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。