This commit is contained in:
Nicolas 2024-08-30 12:37:45 -03:00
parent 552328d168
commit b8920d6f4a
2 changed files with 6 additions and 6 deletions

View File

@ -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();

View File

@ -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 ?? "",
};
}