fix(scrape): ensure extractionSchema is an object if llm-extraction is specified

This commit is contained in:
Gergő Móricz 2024-08-22 14:50:51 +02:00
parent 4bd2ff26d3
commit 0e8fd6ce70
1 changed files with 4 additions and 0 deletions

View File

@ -105,6 +105,10 @@ export async function scrapeController(req: Request, res: Response) {
let timeout = req.body.timeout ?? defaultTimeout;
if (extractorOptions.mode.includes("llm-extraction")) {
if (typeof extractorOptions.extractionSchema !== "object" || extractorOptions.extractionSchema === null) {
return res.status(400).json({ error: "extractorOptions.extractionSchema must be an object if llm-extraction mode is specified" });
}
pageOptions.onlyMainContent = true;
timeout = req.body.timeout ?? 90000;
}