From cd1b0e01a0b3c5cc1c3704dee0500e34cc29fc1d Mon Sep 17 00:00:00 2001 From: one Date: Fri, 22 Aug 2025 09:09:21 +0800 Subject: [PATCH] fix: add provider check in isMandatoryWebSearchModel (#9398) * fix: add provider check in isMandatoryWebSearchModel * Fix: Add provider check in isMandatoryWebSearchModel The isMandatoryWebSearchModel function was throwing an error when the provider was undefined. This change adds a check to ensure the provider exists before accessing its properties, similar to how it's handled in isWebSearchModel. The position of the check has also been moved to be between the provider and modelId initializations for better code flow. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- src/renderer/src/config/models.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/renderer/src/config/models.ts b/src/renderer/src/config/models.ts index 9ee608b1b0..5425c918db 100644 --- a/src/renderer/src/config/models.ts +++ b/src/renderer/src/config/models.ts @@ -3014,6 +3014,11 @@ export function isMandatoryWebSearchModel(model: Model): boolean { } const provider = getProviderByModel(model) + + if (!provider) { + return false + } + const modelId = getLowerBaseModelName(model.id) if (provider.id === 'perplexity' || provider.id === 'openrouter') {