diff --git a/src/renderer/src/config/models.ts b/src/renderer/src/config/models.ts index 3c849cc854..679511f9c9 100644 --- a/src/renderer/src/config/models.ts +++ b/src/renderer/src/config/models.ts @@ -2594,9 +2594,11 @@ export function isWebSearchModel(model: Model): boolean { return false } + const baseName = getBaseModelName(model.id, '/').toLowerCase() + // 不管哪个供应商都判断了 if (model.id.includes('claude')) { - return CLAUDE_SUPPORTED_WEBSEARCH_REGEX.test(model.id) + return CLAUDE_SUPPORTED_WEBSEARCH_REGEX.test(baseName) } if (provider.type === 'openai-response') { @@ -2608,7 +2610,7 @@ export function isWebSearchModel(model: Model): boolean { } if (provider.id === 'perplexity') { - return PERPLEXITY_SEARCH_MODELS.includes(model?.id) + return PERPLEXITY_SEARCH_MODELS.includes(baseName) } if (provider.id === 'aihubmix') { @@ -2617,31 +2619,31 @@ export function isWebSearchModel(model: Model): boolean { } 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) + return models.includes(baseName) } if (provider?.type === 'openai') { - if (GEMINI_SEARCH_MODELS.includes(model?.id) || isOpenAIWebSearchModel(model)) { + if (GEMINI_SEARCH_MODELS.includes(baseName) || isOpenAIWebSearchModel(model)) { return true } } if (provider.id === 'gemini' || provider?.type === 'gemini') { - return GEMINI_SEARCH_MODELS.includes(model?.id) + return GEMINI_SEARCH_MODELS.includes(baseName) } if (provider.id === 'hunyuan') { - return model?.id !== 'hunyuan-lite' + return baseName !== 'hunyuan-lite' } if (provider.id === 'zhipu') { - return model?.id?.startsWith('glm-4-') + return baseName?.startsWith('glm-4-') } if (provider.id === 'dashscope') { const models = ['qwen-turbo', 'qwen-max', 'qwen-plus', 'qwq'] // matches id like qwen-max-0919, qwen-max-latest - return models.some((i) => model.id.startsWith(i)) + return models.some((i) => baseName.startsWith(i)) } if (provider.id === 'openrouter') { @@ -2685,7 +2687,9 @@ export function isGenerateImageModel(model: Model): boolean { if (isEmbedding) { return false } - if (GENERATE_IMAGE_MODELS.includes(model.id)) { + + const baseName = getBaseModelName(model.id, '/').toLowerCase() + if (GENERATE_IMAGE_MODELS.includes(baseName)) { return true } return false