From 29d8c4a7ede6d1521b074482a9689addab31d169 Mon Sep 17 00:00:00 2001 From: SuYao Date: Fri, 9 Jan 2026 15:00:31 +0800 Subject: [PATCH] fix(aiCore): only apply sendReasoning for openai-compatible SDK providers (#12387) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sendReasoning is a patch specific to @ai-sdk/openai-compatible package. Previously it was incorrectly applied to all providers in buildGenericProviderOptions, including those with dedicated SDK packages (e.g., cerebras, deepseek, openrouter). Now it only applies when the provider will actually use openai-compatible SDK: - No dedicated SDK registered (!hasProviderConfig(providerId)) - OR explicitly openai-compatible (providerId === 'openai-compatible') 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 --- src/renderer/src/aiCore/utils/options.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/aiCore/utils/options.ts b/src/renderer/src/aiCore/utils/options.ts index 8dc7a10af9..1a16ea05da 100644 --- a/src/renderer/src/aiCore/utils/options.ts +++ b/src/renderer/src/aiCore/utils/options.ts @@ -3,7 +3,7 @@ import { type AnthropicProviderOptions } from '@ai-sdk/anthropic' import type { GoogleGenerativeAIProviderOptions } from '@ai-sdk/google' import type { OpenAIResponsesProviderOptions } from '@ai-sdk/openai' import type { XaiProviderOptions } from '@ai-sdk/xai' -import { baseProviderIdSchema, customProviderIdSchema } from '@cherrystudio/ai-core/provider' +import { baseProviderIdSchema, customProviderIdSchema, hasProviderConfig } from '@cherrystudio/ai-core/provider' import { loggerService } from '@logger' import { getModelSupportedVerbosity, @@ -616,9 +616,14 @@ function buildGenericProviderOptions( } if (enableReasoning) { if (isInterleavedThinkingModel(model)) { - providerOptions = { - ...providerOptions, - sendReasoning: true + // sendReasoning is a patch specific to @ai-sdk/openai-compatible + // Only apply when provider will actually use openai-compatible SDK + // (i.e., no dedicated SDK registered OR explicitly openai-compatible) + if (!hasProviderConfig(providerId) || providerId === 'openai-compatible') { + providerOptions = { + ...providerOptions, + sendReasoning: true + } } } }