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>
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user