mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
fix: max search result (#11883)
* fix: add search result limit * fix: typo * Update src/renderer/src/aiCore/utils/websearch.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: test * Apply suggestion from @GeorgeDong32 Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: George·Dong <98630204+GeorgeDong32@users.noreply.github.com>
This commit is contained in:
parent
f0ec2354dc
commit
ee7eee24da
@ -259,7 +259,7 @@ describe('websearch utils', () => {
|
||||
|
||||
expect(result).toEqual({
|
||||
xai: {
|
||||
maxSearchResults: 50,
|
||||
maxSearchResults: 30,
|
||||
returnCitations: true,
|
||||
sources: [{ type: 'web', excludedWebsites: [] }, { type: 'news' }, { type: 'x' }],
|
||||
mode: 'on'
|
||||
|
||||
@ -9,6 +9,8 @@ import type { CherryWebSearchConfig } from '@renderer/store/websearch'
|
||||
import type { Model } from '@renderer/types'
|
||||
import { mapRegexToPatterns } from '@renderer/utils/blacklistMatchPattern'
|
||||
|
||||
const X_AI_MAX_SEARCH_RESULT = 30
|
||||
|
||||
export function getWebSearchParams(model: Model): Record<string, any> {
|
||||
if (model.provider === 'hunyuan') {
|
||||
return { enable_enhancement: true, citation: true, search_info: true }
|
||||
@ -82,7 +84,7 @@ export function buildProviderBuiltinWebSearchConfig(
|
||||
const excludeDomains = mapRegexToPatterns(webSearchConfig.excludeDomains)
|
||||
return {
|
||||
xai: {
|
||||
maxSearchResults: webSearchConfig.maxResults,
|
||||
maxSearchResults: Math.min(webSearchConfig.maxResults, X_AI_MAX_SEARCH_RESULT),
|
||||
returnCitations: true,
|
||||
sources: [
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user