Skip to content

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

fix(v1): don't fail on doc = null

Gergo Moricz6a6b48747400
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 20f1b775b..12d1c5011 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -292,6 +292,8 @@ export function legacyScrapeOptions(x: ScrapeOptions): PageOptions {
}
export function legacyDocumentConverter(doc: any): Document {
+ if (doc === null || doc === undefined) return doc;
+
if (doc.metadata) {
if (doc.metadata.screenshot) {
doc.screenshot = doc.metadata.screenshot;