mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 03:10:08 +08:00
fix: update token limits for Claude-4 models and refine reasoning checks in OpenAIProvider
- Adjusted max token limit for 'claude-sonnet-4' and 'claude-opus-4' models from 64000 to 32000. - Simplified reasoning checks in OpenAIProvider to combine conditions for supported models, enhancing code clarity.
This commit is contained in:
parent
6dba08754f
commit
173e64799e
@ -2617,7 +2617,7 @@ export const THINKING_TOKEN_MAP: Record<string, { min: number; max: number }> =
|
||||
|
||||
// Claude models
|
||||
'claude-3[.-]7.*sonnet.*$': { min: 1024, max: 64000 },
|
||||
'claude-(:?sonnet|opus)-4.*$': { min: 1024, max: 64000 }
|
||||
'claude-(:?sonnet|opus)-4.*$': { min: 1024, max: 32000 }
|
||||
}
|
||||
|
||||
export const findTokenLimit = (modelId: string): { min: number; max: number } | undefined => {
|
||||
|
||||
@ -281,21 +281,13 @@ export default class OpenAIProvider extends BaseOpenAIProvider {
|
||||
|
||||
// OpenRouter models
|
||||
if (model.provider === 'openrouter') {
|
||||
if (isSupportedReasoningEffortModel(model)) {
|
||||
if (isSupportedReasoningEffortModel(model) || isSupportedThinkingTokenModel(model)) {
|
||||
return {
|
||||
reasoning: {
|
||||
effort: assistant?.settings?.reasoning_effort
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isSupportedThinkingTokenModel(model)) {
|
||||
return {
|
||||
reasoning: {
|
||||
max_tokens: budgetTokens
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Qwen models
|
||||
@ -634,7 +626,10 @@ export default class OpenAIProvider extends BaseOpenAIProvider {
|
||||
|
||||
if (chunk.choices && chunk.choices.length > 0) {
|
||||
const delta = chunk.choices[0]?.delta
|
||||
if (delta?.reasoning_content || delta?.reasoning) {
|
||||
if (
|
||||
(delta?.reasoning_content && delta?.reasoning_content !== '\n') ||
|
||||
(delta?.reasoning && delta?.reasoning !== '\n')
|
||||
) {
|
||||
yield { type: 'reasoning', textDelta: delta.reasoning_content || delta.reasoning }
|
||||
}
|
||||
if (delta?.content) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user