feat: Refine keyword generation logic, enforce Serper API usage, and enhance search query construction with platform-specific templates.

This commit is contained in:
2026-02-03 22:52:13 +00:00
parent 358f2a42dd
commit f9222627ef
7 changed files with 274 additions and 209 deletions

View File

@@ -20,7 +20,6 @@ const searchSchema = z.object({
rateLimit: z.number()
})),
strategies: z.array(z.string()),
intensity: z.enum(['broad', 'balanced', 'targeted']),
maxResults: z.number().default(50)
})
})
@@ -41,6 +40,18 @@ export async function POST(request: NextRequest) {
const { projectId, config } = parsed
jobId = parsed.jobId
if (!process.env.SERPER_API_KEY) {
const errorMessage = "SERPER_API_KEY is not configured. Add it to your environment to run searches."
if (jobId) {
await fetchMutation(
api.searchJobs.update,
{ jobId: jobId as any, status: "failed", error: errorMessage },
{ token: await convexAuthNextjsToken() }
)
}
return NextResponse.json({ error: errorMessage }, { status: 400 })
}
const token = await convexAuthNextjsToken();
if (jobId) {
await fetchMutation(