


















@@ -4,13 +4,24 @@ import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
44import { resolveFastModeState } from "../agents/fast-mode.js";
55import {
66resolveConfiguredModelRef,
7-resolveReasoningDefault,
87resolveThinkingDefault,
8+legacyModelKey,
9+modelKey,
910} from "../agents/model-selection.js";
1011import type { OpenClawConfig } from "../config/types.openclaw.js";
1112import { getResolvedLoggerSettings } from "../logging.js";
1213import { collectEnabledInsecureOrDangerousFlags } from "../security/dangerous-config-flags.js";
131415+type StartupThinkLevel =
16+| "off"
17+| "minimal"
18+| "low"
19+| "medium"
20+| "high"
21+| "xhigh"
22+| "adaptive"
23+| "max";
24+1425export function logGatewayStartup(params: {
1526cfg: OpenClawConfig;
1627bindHost: string;
@@ -57,35 +68,65 @@ export function logGatewayStartup(params: {
5768}
5869}
597071+function normalizeStartupThinkLevel(value: unknown): StartupThinkLevel | undefined {
72+return value === "off" ||
73+value === "minimal" ||
74+value === "low" ||
75+value === "medium" ||
76+value === "high" ||
77+value === "xhigh" ||
78+value === "adaptive" ||
79+value === "max"
80+ ? value
81+ : undefined;
82+}
83+84+function resolveExplicitStartupThinking(params: {
85+cfg: OpenClawConfig;
86+provider: string;
87+model: string;
88+defaultAgentThinking: unknown;
89+}): StartupThinkLevel | undefined {
90+const models = params.cfg.agents?.defaults?.models;
91+const canonicalKey = modelKey(params.provider, params.model);
92+const legacyKey = legacyModelKey(params.provider, params.model);
93+return (
94+normalizeStartupThinkLevel(params.defaultAgentThinking) ??
95+normalizeStartupThinkLevel(models?.[canonicalKey]?.params?.thinking) ??
96+normalizeStartupThinkLevel(legacyKey ? models?.[legacyKey]?.params?.thinking : undefined) ??
97+normalizeStartupThinkLevel(params.cfg.agents?.defaults?.thinkingDefault)
98+);
99+}
100+60101export function formatAgentModelStartupDetails(params: {
61102cfg: OpenClawConfig;
62103provider: string;
63104model: string;
64105}): string {
65106const defaultAgentId = resolveDefaultAgentId(params.cfg);
66107const defaultAgentConfig = resolveAgentConfig(params.cfg, defaultAgentId);
67-const thinking =
68-defaultAgentConfig?.thinkingDefault ??
108+const explicitThinking = resolveExplicitStartupThinking({
109+cfg: params.cfg,
110+provider: params.provider,
111+model: params.model,
112+defaultAgentThinking: defaultAgentConfig?.thinkingDefault,
113+});
114+const resolvedThinking =
115+explicitThinking ??
69116resolveThinkingDefault({
70117cfg: params.cfg,
71118provider: params.provider,
72119model: params.model,
73120});
74-const reasoning =
75-defaultAgentConfig?.reasoningDefault ??
76-params.cfg.agents?.defaults?.reasoningDefault ??
77-resolveReasoningDefault({
78-provider: params.provider,
79-model: params.model,
80-});
121+const thinking = explicitThinking ?? (resolvedThinking === "off" ? "medium" : resolvedThinking);
81122const fast = resolveFastModeState({
82123cfg: params.cfg,
83124provider: params.provider,
84125model: params.model,
85126agentId: defaultAgentId,
86127});
8712888-return `thinking=${thinking}, reasoning=${reasoning}, fast=${fast.enabled ? "on" : "off"}`;
129+return `thinking=${thinking}, fast=${fast.enabled ? "on" : "off"}`;
89130}
9013191132function formatReadyDetails(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。