feat: Refine keyword generation logic, enforce Serper API usage, and enhance search query construction with platform-specific templates.
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user