mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-23 01:50:13 +08:00
feat: add Claude Haiku 4.5 model support and update related regex patterns (#10800)
* feat: add Claude Haiku 4.5 model support and update related regex patterns * fix: update Claude model token limits for consistency
This commit is contained in:
parent
595fd878a6
commit
dc0f9c5f08
@ -430,6 +430,12 @@ export const SYSTEM_MODELS: Record<SystemProviderId | 'defaultModel', Model[]> =
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
anthropic: [
|
anthropic: [
|
||||||
|
{
|
||||||
|
id: 'claude-haiku-4-5-20251001',
|
||||||
|
provider: 'anthropic',
|
||||||
|
name: 'Claude Haiku 4.5',
|
||||||
|
group: 'Claude 4.5'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'claude-sonnet-4-5-20250929',
|
id: 'claude-sonnet-4-5-20250929',
|
||||||
provider: 'anthropic',
|
provider: 'anthropic',
|
||||||
|
|||||||
@ -335,7 +335,8 @@ export function isClaudeReasoningModel(model?: Model): boolean {
|
|||||||
modelId.includes('claude-3-7-sonnet') ||
|
modelId.includes('claude-3-7-sonnet') ||
|
||||||
modelId.includes('claude-3.7-sonnet') ||
|
modelId.includes('claude-3.7-sonnet') ||
|
||||||
modelId.includes('claude-sonnet-4') ||
|
modelId.includes('claude-sonnet-4') ||
|
||||||
modelId.includes('claude-opus-4')
|
modelId.includes('claude-opus-4') ||
|
||||||
|
modelId.includes('claude-haiku-4')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,8 +494,9 @@ export const THINKING_TOKEN_MAP: Record<string, { min: number; max: number }> =
|
|||||||
'qwen3-(?!max).*$': { min: 1024, max: 38_912 },
|
'qwen3-(?!max).*$': { min: 1024, max: 38_912 },
|
||||||
|
|
||||||
// Claude models
|
// Claude models
|
||||||
'claude-3[.-]7.*sonnet.*$': { min: 1024, max: 64000 },
|
'claude-3[.-]7.*sonnet.*$': { min: 1024, max: 64_000 },
|
||||||
'claude-(:?sonnet|opus)-4.*$': { min: 1024, max: 32000 }
|
'claude-(:?haiku|sonnet)-4.*$': { min: 1024, max: 64_000 },
|
||||||
|
'claude-opus-4-1.*$': { min: 1024, max: 32_000 }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const findTokenLimit = (modelId: string): { min: number; max: number } | undefined => {
|
export const findTokenLimit = (modelId: string): { min: number; max: number } | undefined => {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const visionAllowedModels = [
|
|||||||
'gemini-(flash|pro|flash-lite)-latest',
|
'gemini-(flash|pro|flash-lite)-latest',
|
||||||
'gemini-exp',
|
'gemini-exp',
|
||||||
'claude-3',
|
'claude-3',
|
||||||
|
'claude-haiku-4',
|
||||||
'claude-sonnet-4',
|
'claude-sonnet-4',
|
||||||
'claude-opus-4',
|
'claude-opus-4',
|
||||||
'vision',
|
'vision',
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { isAnthropicModel } from './utils'
|
|||||||
import { isPureGenerateImageModel, isTextToImageModel } from './vision'
|
import { isPureGenerateImageModel, isTextToImageModel } from './vision'
|
||||||
|
|
||||||
export const CLAUDE_SUPPORTED_WEBSEARCH_REGEX = new RegExp(
|
export const CLAUDE_SUPPORTED_WEBSEARCH_REGEX = new RegExp(
|
||||||
`\\b(?:claude-3(-|\\.)(7|5)-sonnet(?:-[\\w-]+)|claude-3(-|\\.)5-haiku(?:-[\\w-]+)|claude-sonnet-4(?:-[\\w-]+)?|claude-opus-4(?:-[\\w-]+)?)\\b`,
|
`\\b(?:claude-3(-|\\.)(7|5)-sonnet(?:-[\\w-]+)|claude-3(-|\\.)5-haiku(?:-[\\w-]+)|claude-(haiku|sonnet|opus)-4(?:-[\\w-]+)?)\\b`,
|
||||||
'i'
|
'i'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user