Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Nick:

Nicolasb8920d6f4afc
diff --git a/apps/api/src/controllers/v1/scrape.ts b/apps/api/src/controllers/v1/scrape.ts
index 3474f37f5..9d0138d17 100644
--- a/apps/api/src/controllers/v1/scrape.ts
+++ b/apps/api/src/controllers/v1/scrape.ts
@@ -28,7 +28,7 @@ export async function scrapeController(
const origin = req.body.origin;
const timeout = req.body.timeout;
const pageOptions = legacyScrapeOptions(req.body);
- const extractorOptions = legacyExtractorOptions(req.body.extract);
+ const extractorOptions = req.body.extract ? legacyExtractorOptions(req.body.extract) : undefined;
const jobId = uuidv4();
const startTime = new Date().getTime();
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index c8981024b..7774823af 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -312,12 +312,12 @@ export function legacyScrapeOptions(x: ScrapeOptions): PageOptions {
};
}
-export function legacyExtractorOptions(x?: ExtractOptions): ExtractorOptions {
+export function legacyExtractorOptions(x: ExtractOptions): ExtractorOptions {
return {
- mode: x?.mode ? "llm-extraction" : "markdown",
- extractionPrompt: x?.prompt ?? "Based on the information on the page, extract the information from the schema.",
- extractionSchema: x?.schema,
- userPrompt: x?.prompt ?? "",
+ mode: x.mode ? "llm-extraction" : "markdown",
+ extractionPrompt: x.prompt ?? "Based on the information on the page, extract the information from the schema.",
+ extractionSchema: x.schema,
+ userPrompt: x.prompt ?? "",
};
}