mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 22:10:21 +08:00
feat(models): update Gemini regex (#10463)
* feat(models): update Gemini regex * fix: lint * fix format
This commit is contained in:
parent
f91e7da0a1
commit
53e38ed1aa
@ -178,9 +178,13 @@ export function isGeminiReasoningModel(model?: Model): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gemini 支持思考模式的模型正则
|
||||||
|
export const GEMINI_THINKING_MODEL_REGEX =
|
||||||
|
/gemini-(?:2\.5.*(?:-latest)?|flash-latest|pro-latest|flash-lite-latest)(?:-[\w-]+)*$/i
|
||||||
|
|
||||||
export const isSupportedThinkingTokenGeminiModel = (model: Model): boolean => {
|
export const isSupportedThinkingTokenGeminiModel = (model: Model): boolean => {
|
||||||
const modelId = getLowerBaseModelName(model.id, '/')
|
const modelId = getLowerBaseModelName(model.id, '/')
|
||||||
if (modelId.includes('gemini-2.5')) {
|
if (GEMINI_THINKING_MODEL_REGEX.test(modelId)) {
|
||||||
if (modelId.includes('image') || modelId.includes('tts')) {
|
if (modelId.includes('image') || modelId.includes('tts')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ const visionAllowedModels = [
|
|||||||
'gemini-1\\.5',
|
'gemini-1\\.5',
|
||||||
'gemini-2\\.0',
|
'gemini-2\\.0',
|
||||||
'gemini-2\\.5',
|
'gemini-2\\.5',
|
||||||
|
'gemini-(flash|pro|flash-lite)-latest',
|
||||||
'gemini-exp',
|
'gemini-exp',
|
||||||
'claude-3',
|
'claude-3',
|
||||||
'claude-sonnet-4',
|
'claude-sonnet-4',
|
||||||
|
|||||||
@ -11,9 +11,12 @@ export const CLAUDE_SUPPORTED_WEBSEARCH_REGEX = new RegExp(
|
|||||||
'i'
|
'i'
|
||||||
)
|
)
|
||||||
|
|
||||||
export const GEMINI_FLASH_MODEL_REGEX = new RegExp('gemini-.*-flash.*$')
|
export const GEMINI_FLASH_MODEL_REGEX = new RegExp('gemini.*-flash.*$')
|
||||||
|
|
||||||
export const GEMINI_SEARCH_REGEX = new RegExp('gemini-2\\..*', 'i')
|
export const GEMINI_SEARCH_REGEX = new RegExp(
|
||||||
|
'gemini-(?:2.*(?:-latest)?|flash-latest|pro-latest|flash-lite-latest)(?:-[\\w-]+)*$',
|
||||||
|
'i'
|
||||||
|
)
|
||||||
|
|
||||||
export const PERPLEXITY_SEARCH_MODELS = [
|
export const PERPLEXITY_SEARCH_MODELS = [
|
||||||
'sonar-pro',
|
'sonar-pro',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user