fix(ai): handle redacted_thinking blocks, skip interleaved beta for adaptive models, drop temperature with thinking
- Map redacted_thinking to ThinkingContent with redacted: true instead of adding a new content type. The opaque payload goes in thinkingSignature, thinking text is set to "[Reasoning redacted]" so it renders naturally everywhere. Cross-model transform drops redacted blocks. - Skip interleaved-thinking-2025-05-14 beta header for Opus 4.6 / Sonnet 4.6 where adaptive thinking makes it deprecated/redundant. - Do not send temperature when thinkingEnabled is true (incompatible with both adaptive and budget-based thinking). Based on #1665 by @tctev
This commit is contained in:
@@ -39,6 +39,11 @@ export function transformMessages<TApi extends Api>(
|
||||
|
||||
const transformedContent = assistantMsg.content.flatMap((block) => {
|
||||
if (block.type === "thinking") {
|
||||
// Redacted thinking is opaque encrypted content, only valid for the same model.
|
||||
// Drop it for cross-model to avoid API errors.
|
||||
if (block.redacted) {
|
||||
return isSameModel ? block : [];
|
||||
}
|
||||
// For same model: keep thinking blocks with signatures (needed for replay)
|
||||
// even if the thinking text is empty (OpenAI encrypted reasoning)
|
||||
if (isSameModel && block.thinkingSignature) return block;
|
||||
|
||||
Reference in New Issue
Block a user