fix: optimize excluded websites handling in xai provider configuration (#10894)

(cherry picked from commit 13093bb821)
This commit is contained in:
SuYao 2025-10-24 15:10:59 +08:00 committed by dev
parent 156ceca4a7
commit 91050899c4

View File

@ -78,6 +78,7 @@ export function buildProviderBuiltinWebSearchConfig(
} }
} }
case 'xai': { case 'xai': {
const excludeDomains = mapRegexToPatterns(webSearchConfig.excludeDomains)
return { return {
xai: { xai: {
maxSearchResults: webSearchConfig.maxResults, maxSearchResults: webSearchConfig.maxResults,
@ -85,7 +86,7 @@ export function buildProviderBuiltinWebSearchConfig(
sources: [ sources: [
{ {
type: 'web', type: 'web',
excludedWebsites: mapRegexToPatterns(webSearchConfig.excludeDomains) excludedWebsites: excludeDomains.slice(0, Math.min(excludeDomains.length, 5))
}, },
{ type: 'news' }, { type: 'news' },
{ type: 'x' } { type: 'x' }