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

@ -40,6 +40,7 @@
const toast = useToast()
const { t, locale } = useI18n()
const { config } = useConfigStore()
const isLargeScreen = useMediaQuery('(min-width: 768px)')
const flowRef = ref<InstanceType<typeof Flow>>()
@ -278,6 +279,7 @@
breadth,
maxDepth: form.value.depth,
languageCode: locale.value,
searchLanguageCode: config.webSearch.searchLanguage,
learnings: existingLearnings,
visitedUrls: existingVisitedUrls,
onProgress: handleResearchProgress,

View File

@ -103,7 +103,6 @@
}
function reset() {
console.warn('reset')
layoutGraph()
hasUserInteraction = false
}

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(