Skip to content

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

Update types.ts

Nicolas7c8ca0c88989
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index fcca81863..0db8c78d3 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -89,7 +89,12 @@ export const scrapeRequestSchema = scrapeOptions.extend({
{
message: "When 'extract' format is specified, 'extract' options must be provided, and vice versa",
}
-);
+).transform((obj) => {
+ if ((obj.formats?.includes("extract") || obj.extract) && !obj.timeout) {
+ return { ...obj, timeout: 60000 };
+ }
+ return obj;
+});
// export type ScrapeRequest = {
// url: string;