mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-14 09:36:03 +08:00
feat(api/v1/extract): ignoreInvalidURLs (#1585)
This commit is contained in:
parent
6478754f1b
commit
749d89a551
@ -62,7 +62,9 @@ export async function extractController(
|
|||||||
const originalRequest = { ...req.body };
|
const originalRequest = { ...req.body };
|
||||||
req.body = extractRequestSchema.parse(req.body);
|
req.body = extractRequestSchema.parse(req.body);
|
||||||
|
|
||||||
if (req.body.urls?.some((url: string) => isUrlBlocked(url, req.acuc?.flags ?? null))) {
|
const invalidURLs: string[] = req.body.urls?.filter((url: string) => isUrlBlocked(url, req.acuc?.flags ?? null)) ?? [];
|
||||||
|
|
||||||
|
if (invalidURLs.length > 0 && !req.body.ignoreInvalidURLs) {
|
||||||
if (!res.headersSent) {
|
if (!res.headersSent) {
|
||||||
return res.status(403).json({
|
return res.status(403).json({
|
||||||
success: false,
|
success: false,
|
||||||
@ -144,5 +146,8 @@ export async function extractController(
|
|||||||
success: true,
|
success: true,
|
||||||
id: extractId,
|
id: extractId,
|
||||||
urlTrace: [],
|
urlTrace: [],
|
||||||
|
...(invalidURLs.length > 0 && req.body.ignoreInvalidURLs ? {
|
||||||
|
invalidURLs,
|
||||||
|
} : {}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -478,6 +478,7 @@ export const extractV1Options = z
|
|||||||
.optional(),
|
.optional(),
|
||||||
agent: agentOptionsExtract.optional(),
|
agent: agentOptionsExtract.optional(),
|
||||||
__experimental_showCostTracking: z.boolean().default(false),
|
__experimental_showCostTracking: z.boolean().default(false),
|
||||||
|
ignoreInvalidURLs: z.boolean().default(false),
|
||||||
})
|
})
|
||||||
.strict(strictMessage)
|
.strict(strictMessage)
|
||||||
.refine((obj) => obj.urls || obj.prompt, {
|
.refine((obj) => obj.urls || obj.prompt, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user