fix(models): reorganize gemini websearch model lists
This commit is contained in:
parent
a2f9067908
commit
57c1b59a51
@ -165,7 +165,15 @@ const visionAllowedModels = [
|
|||||||
'gemma-3(?:-[\\w-]+)'
|
'gemma-3(?:-[\\w-]+)'
|
||||||
]
|
]
|
||||||
|
|
||||||
const visionExcludedModels = ['gpt-4-\\d+-preview', 'gpt-4-turbo-preview', 'gpt-4-32k', 'gpt-4-\\d+', 'o1-mini', 'o1-preview', 'AIDC-AI/Marco-o1']
|
const visionExcludedModels = [
|
||||||
|
'gpt-4-\\d+-preview',
|
||||||
|
'gpt-4-turbo-preview',
|
||||||
|
'gpt-4-32k',
|
||||||
|
'gpt-4-\\d+',
|
||||||
|
'o1-mini',
|
||||||
|
'o1-preview',
|
||||||
|
'AIDC-AI/Marco-o1'
|
||||||
|
]
|
||||||
export const VISION_REGEX = new RegExp(
|
export const VISION_REGEX = new RegExp(
|
||||||
`\\b(?!(?:${visionExcludedModels.join('|')})\\b)(${visionAllowedModels.join('|')})\\b`,
|
`\\b(?!(?:${visionExcludedModels.join('|')})\\b)(${visionAllowedModels.join('|')})\\b`,
|
||||||
'i'
|
'i'
|
||||||
@ -203,7 +211,13 @@ export const FUNCTION_CALLING_MODELS = [
|
|||||||
'gemini(?:-[\\w-]+)?' // 提前排除了gemini的嵌入模型
|
'gemini(?:-[\\w-]+)?' // 提前排除了gemini的嵌入模型
|
||||||
]
|
]
|
||||||
|
|
||||||
const FUNCTION_CALLING_EXCLUDED_MODELS = ['aqa(?:-[\\w-]+)?', 'imagen(?:-[\\w-]+)?', 'o1-mini', 'o1-preview', 'AIDC-AI/Marco-o1']
|
const FUNCTION_CALLING_EXCLUDED_MODELS = [
|
||||||
|
'aqa(?:-[\\w-]+)?',
|
||||||
|
'imagen(?:-[\\w-]+)?',
|
||||||
|
'o1-mini',
|
||||||
|
'o1-preview',
|
||||||
|
'AIDC-AI/Marco-o1'
|
||||||
|
]
|
||||||
|
|
||||||
export const FUNCTION_CALLING_REGEX = new RegExp(
|
export const FUNCTION_CALLING_REGEX = new RegExp(
|
||||||
`\\b(?!(?:${FUNCTION_CALLING_EXCLUDED_MODELS.join('|')})\\b)(?:${FUNCTION_CALLING_MODELS.join('|')})\\b`,
|
`\\b(?!(?:${FUNCTION_CALLING_EXCLUDED_MODELS.join('|')})\\b)(?:${FUNCTION_CALLING_MODELS.join('|')})\\b`,
|
||||||
@ -1944,6 +1958,17 @@ export const TEXT_TO_IMAGES_MODELS_SUPPORT_IMAGE_ENHANCEMENT = [
|
|||||||
|
|
||||||
export const GENERATE_IMAGE_MODELS = ['gemini-2.0-flash-exp-image-generation', 'gemini-2.0-flash-exp']
|
export const GENERATE_IMAGE_MODELS = ['gemini-2.0-flash-exp-image-generation', 'gemini-2.0-flash-exp']
|
||||||
|
|
||||||
|
export const GEMINI_SEARCH_MODELS = [
|
||||||
|
'gemini-2.0-flash',
|
||||||
|
'gemini-2.0-flash-lite',
|
||||||
|
'gemini-2.0-flash-exp',
|
||||||
|
'gemini-2.0-flash-001',
|
||||||
|
'gemini-2.0-pro-exp-02-05',
|
||||||
|
'gemini-2.0-pro-exp',
|
||||||
|
'gemini-2.5-pro-exp',
|
||||||
|
'gemini-2.5-pro-exp-03-25'
|
||||||
|
]
|
||||||
|
|
||||||
export function isTextToImageModel(model: Model): boolean {
|
export function isTextToImageModel(model: Model): boolean {
|
||||||
return TEXT_TO_IMAGE_REGEX.test(model.id)
|
return TEXT_TO_IMAGE_REGEX.test(model.id)
|
||||||
}
|
}
|
||||||
@ -2048,34 +2073,25 @@ export function isWebSearchModel(model: Model): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (provider.id === 'aihubmix') {
|
||||||
|
const models = ['gemini-2.0-flash-search', 'gemini-2.0-flash-exp-search', 'gemini-2.0-pro-exp-02-05-search']
|
||||||
|
return models.includes(model?.id)
|
||||||
|
}
|
||||||
|
|
||||||
if (provider?.type === 'openai') {
|
if (provider?.type === 'openai') {
|
||||||
if (model?.id?.includes('gemini-2.0-flash-exp')) {
|
if (GEMINI_SEARCH_MODELS.includes(model?.id)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.id === 'gemini' || provider?.type === 'gemini') {
|
if (provider.id === 'gemini' || provider?.type === 'gemini') {
|
||||||
const models = [
|
return GEMINI_SEARCH_MODELS.includes(model?.id)
|
||||||
'gemini-2.0-flash',
|
|
||||||
'gemini-2.0-flash-exp',
|
|
||||||
'gemini-2.0-flash-001',
|
|
||||||
'gemini-2.0-pro-exp-02-05',
|
|
||||||
'gemini-2.0-pro-exp',
|
|
||||||
'gemini-2.5-pro-exp',
|
|
||||||
'gemini-2.5-pro-exp-03-25'
|
|
||||||
]
|
|
||||||
return models.includes(model?.id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.id === 'hunyuan') {
|
if (provider.id === 'hunyuan') {
|
||||||
return model?.id !== 'hunyuan-lite'
|
return model?.id !== 'hunyuan-lite'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.id === 'aihubmix') {
|
|
||||||
const models = ['gemini-2.0-flash-search', 'gemini-2.0-flash-exp-search', 'gemini-2.0-pro-exp-02-05-search']
|
|
||||||
return models.includes(model?.id)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (provider.id === 'zhipu') {
|
if (provider.id === 'zhipu') {
|
||||||
return model?.id?.startsWith('glm-4-')
|
return model?.id?.startsWith('glm-4-')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user