Thinking: gate xhigh by model
This commit is contained in:
committed by
Peter Steinberger
parent
f50e06a1b6
commit
a3641526ab
@@ -8,10 +8,13 @@ import {
|
||||
} from "../agents/model-selection.js";
|
||||
import { normalizeGroupActivation } from "../auto-reply/group-activation.js";
|
||||
import {
|
||||
formatThinkingLevels,
|
||||
formatXHighModelHint,
|
||||
normalizeElevatedLevel,
|
||||
normalizeReasoningLevel,
|
||||
normalizeThinkLevel,
|
||||
normalizeUsageDisplay,
|
||||
supportsXHighThinking,
|
||||
} from "../auto-reply/thinking.js";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import type { SessionEntry } from "../config/sessions.js";
|
||||
@@ -95,8 +98,17 @@ export async function applySessionsPatchToStore(params: {
|
||||
} else if (raw !== undefined) {
|
||||
const normalized = normalizeThinkLevel(String(raw));
|
||||
if (!normalized) {
|
||||
const resolvedDefault = resolveConfiguredModelRef({
|
||||
cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
defaultModel: DEFAULT_MODEL,
|
||||
});
|
||||
const hintProvider =
|
||||
existing?.providerOverride?.trim() || resolvedDefault.provider;
|
||||
const hintModel =
|
||||
existing?.modelOverride?.trim() || resolvedDefault.model;
|
||||
return invalid(
|
||||
"invalid thinkingLevel (use off|minimal|low|medium|high)",
|
||||
`invalid thinkingLevel (use ${formatThinkingLevels(hintProvider, hintModel, "|")})`,
|
||||
);
|
||||
}
|
||||
if (normalized === "off") delete next.thinkingLevel;
|
||||
@@ -196,6 +208,24 @@ export async function applySessionsPatchToStore(params: {
|
||||
}
|
||||
}
|
||||
|
||||
if (next.thinkingLevel === "xhigh") {
|
||||
const resolvedDefault = resolveConfiguredModelRef({
|
||||
cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
defaultModel: DEFAULT_MODEL,
|
||||
});
|
||||
const effectiveProvider = next.providerOverride ?? resolvedDefault.provider;
|
||||
const effectiveModel = next.modelOverride ?? resolvedDefault.model;
|
||||
if (!supportsXHighThinking(effectiveProvider, effectiveModel)) {
|
||||
if ("thinkingLevel" in patch) {
|
||||
return invalid(
|
||||
`thinkingLevel "xhigh" is only supported for ${formatXHighModelHint()}`,
|
||||
);
|
||||
}
|
||||
next.thinkingLevel = "high";
|
||||
}
|
||||
}
|
||||
|
||||
if ("sendPolicy" in patch) {
|
||||
const raw = patch.sendPolicy;
|
||||
if (raw === null) {
|
||||
|
||||
Reference in New Issue
Block a user