fix(deep-research): apply search language correctly

This commit is contained in:
AnotiaWang
2025-02-25 16:12:47 +08:00
parent f58bced86e
commit 4b86257a1d
3 changed files with 10 additions and 3 deletions

View File

@ -218,6 +218,7 @@ export async function deepResearch({
breadth,
maxDepth,
languageCode,
searchLanguageCode,
learnings = [],
visitedUrls = [],
onProgress,
@ -228,8 +229,10 @@ export async function deepResearch({
query: string
breadth: number
maxDepth: number
/** Language code for SERP queries and web searches */
/** The language of generated response */
languageCode: Locale
/** The language of SERP query */
searchLanguageCode?: Locale
/** Accumulated learnings from all nodes visited so far */
learnings?: string[]
/** Accumulated visited URLs from all nodes visited so far */
@ -243,6 +246,9 @@ export async function deepResearch({
}): Promise<ResearchResult> {
const { t } = useNuxtApp().$i18n
const language = t('language', {}, { locale: languageCode })
const searchLanguage = searchLanguageCode
? t('language', {}, { locale: searchLanguageCode })
: undefined
const globalLimit = usePLimit()
try {
@ -266,7 +272,7 @@ export async function deepResearch({
learnings,
numQueries: breadth,
language,
searchLanguage: language,
searchLanguage,
})
for await (const chunk of parseStreamingJson(