fix(deep-research): searchLanguage is missing when recursively calling deepResearch

This commit is contained in:
AnotiaWang
2025-02-18 12:57:56 +08:00
parent eada822366
commit f593546864

View File

@ -92,21 +92,23 @@ export function generateSearchQueries({
const schema = z.object({
queries: z
.array(
z.object({
query: z.string().describe('The SERP query'),
z
.object({
query: z.string().describe('The SERP query.'),
researchGoal: z
.string()
.describe(
'First talk about the goal of the research that this query is meant to accomplish, then go deeper into how to advance the research once the results are found, mention additional research directions. Be as specific as possible, especially for additional research directions.',
),
}),
})
.required({ query: true, researchGoal: true }),
)
.describe(`List of SERP queries, max of ${numQueries}`),
})
const jsonSchema = JSON.stringify(zodToJsonSchema(schema))
let lp = languagePrompt(language)
if (searchLanguage !== language) {
if (searchLanguage && searchLanguage !== language) {
lp += ` Use ${searchLanguage} for the SERP queries.`
}
const prompt = [
@ -443,6 +445,7 @@ export async function deepResearch({
currentDepth: nextDepth,
nodeId: childNodeId(nodeId, i),
languageCode,
searchLanguage,
})
return r
} catch (error) {