mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:01:23 +00:00
* Default reasoning to on when model has reasoning: true (fix #22456) What: When a model is configured with reasoning: true in openclaw.json (e.g. OpenRouter x-ai/grok-4.1-fast), the session now defaults reasoningLevel to on if the user has not set it via /reasoning or session store. Why: Users expected setting reasoning: true on the model to enable reasoning; previously only session/directive reasoningLevel was used and it always defaulted to off, so Think stayed off despite the model config. * Chore: sync formatted files from main for CI * Changelog: note zwffff/main OpenRouter fix * Changelog: fix OpenRouter entry text * Update msteams.md * Update msteams.md * Update msteams.md --------- Co-authored-by: 曾文锋0668000834 <zeng.wenfeng@xydigit.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
modelKey,
|
||||
normalizeProviderId,
|
||||
resolveModelRefFromString,
|
||||
resolveReasoningDefault,
|
||||
resolveThinkingDefault,
|
||||
} from "../../agents/model-selection.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
@@ -32,6 +33,8 @@ type ModelSelectionState = {
|
||||
allowedModelCatalog: ModelCatalog;
|
||||
resetModelOverride: boolean;
|
||||
resolveDefaultThinkingLevel: () => Promise<ThinkLevel>;
|
||||
/** Default reasoning level from model capability: "on" if model has reasoning, else "off". */
|
||||
resolveDefaultReasoningLevel: () => Promise<"on" | "off">;
|
||||
needsModelCatalog: boolean;
|
||||
};
|
||||
|
||||
@@ -397,6 +400,19 @@ export async function createModelSelectionState(params: {
|
||||
return defaultThinkingLevel;
|
||||
};
|
||||
|
||||
const resolveDefaultReasoningLevel = async (): Promise<"on" | "off"> => {
|
||||
let catalogForReasoning = modelCatalog ?? allowedModelCatalog;
|
||||
if (!catalogForReasoning || catalogForReasoning.length === 0) {
|
||||
modelCatalog = await loadModelCatalog({ config: cfg });
|
||||
catalogForReasoning = modelCatalog;
|
||||
}
|
||||
return resolveReasoningDefault({
|
||||
provider,
|
||||
model,
|
||||
catalog: catalogForReasoning,
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
provider,
|
||||
model,
|
||||
@@ -404,6 +420,7 @@ export async function createModelSelectionState(params: {
|
||||
allowedModelCatalog,
|
||||
resetModelOverride,
|
||||
resolveDefaultThinkingLevel,
|
||||
resolveDefaultReasoningLevel,
|
||||
needsModelCatalog,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user