fix(parameter-builder): avoid enabling built-in web search when external provider is configured (#9995)

This commit is contained in:
George·Dong 2025-09-07 10:17:01 +08:00 committed by GitHub
parent d09743d254
commit b33b14b4b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,11 +67,14 @@ export async function buildStreamTextParams(
assistant.settings?.reasoning_effort !== undefined) ||
(isReasoningModel(model) && (!isSupportedThinkingTokenModel(model) || !isSupportedReasoningEffortModel(model)))
// 判断是否使用内置搜索
// 条件:没有外部搜索提供商 && (用户开启了内置搜索 || 模型强制使用内置搜索)
const hasExternalSearch = !!options.webSearchProviderId
const enableWebSearch =
(assistant.enableWebSearch && isWebSearchModel(model)) ||
!hasExternalSearch &&
((assistant.enableWebSearch && isWebSearchModel(model)) ||
isOpenRouterBuiltInWebSearchModel(model) ||
model.id.includes('sonar') ||
false
model.id.includes('sonar'))
const enableUrlContext = assistant.enableUrlContext || false