mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-01 09:49:03 +08:00
fix: API call error for Grok reasoning model via OpenRouter (#8252)
fix: openrouter reasoning disabled error
This commit is contained in:
parent
7c268088d4
commit
b90a8423f1
@ -5,6 +5,7 @@ import {
|
||||
GEMINI_FLASH_MODEL_REGEX,
|
||||
getOpenAIWebSearchParams,
|
||||
isDoubaoThinkingAutoModel,
|
||||
isGrokReasoningModel,
|
||||
isQwenReasoningModel,
|
||||
isReasoningModel,
|
||||
isSupportedReasoningEffortGrokModel,
|
||||
@ -117,11 +118,12 @@ export class OpenAIAPIClient extends OpenAIBaseClient<
|
||||
|
||||
if (!reasoningEffort) {
|
||||
if (model.provider === 'openrouter') {
|
||||
if (
|
||||
isSupportedThinkingTokenGeminiModel(model) &&
|
||||
!GEMINI_FLASH_MODEL_REGEX.test(model.id) &&
|
||||
model.id.includes('grok-4')
|
||||
) {
|
||||
// Don't disable reasoning for Gemini models that support thinking tokens
|
||||
if (isSupportedThinkingTokenGeminiModel(model) && !GEMINI_FLASH_MODEL_REGEX.test(model.id)) {
|
||||
return {}
|
||||
}
|
||||
// Don't disable reasoning for models that require it
|
||||
if (isGrokReasoningModel(model)) {
|
||||
return {}
|
||||
}
|
||||
return { reasoning: { enabled: false, exclude: true } }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user