fix(ai): Fix a configuration bug with Opus 4.7 adaptive thinking (#3286)

This commit is contained in:
Markus Ylisiurunen
2026-04-16 20:57:19 +03:00
committed by GitHub
parent 72619e9246
commit d1c6cb1e0f
9 changed files with 223 additions and 20 deletions

View File

@@ -423,12 +423,14 @@ function handleContentBlockStop(
}
/**
* Check if the model supports adaptive thinking (Opus 4.6 and Sonnet 4.6).
* Check if the model supports adaptive thinking (Opus 4.6+, Sonnet 4.6).
*/
function supportsAdaptiveThinking(modelId: string): boolean {
return (
modelId.includes("opus-4-6") ||
modelId.includes("opus-4.6") ||
modelId.includes("opus-4-7") ||
modelId.includes("opus-4.7") ||
modelId.includes("sonnet-4-6") ||
modelId.includes("sonnet-4.6")
);
@@ -437,7 +439,7 @@ function supportsAdaptiveThinking(modelId: string): boolean {
function mapThinkingLevelToEffort(
level: SimpleStreamOptions["reasoning"],
modelId: string,
): "low" | "medium" | "high" | "max" {
): "low" | "medium" | "high" | "xhigh" | "max" {
switch (level) {
case "minimal":
case "low":
@@ -447,7 +449,13 @@ function mapThinkingLevelToEffort(
case "high":
return "high";
case "xhigh":
return modelId.includes("opus-4-6") || modelId.includes("opus-4.6") ? "max" : "high";
if (modelId.includes("opus-4-6") || modelId.includes("opus-4.6")) {
return "max";
}
if (modelId.includes("opus-4-7") || modelId.includes("opus-4.7")) {
return "xhigh";
}
return "high";
default:
return "high";
}