mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-06 05:38:10 +08:00
Nick: extract fixes
This commit is contained in:
parent
c9b0a80522
commit
d49f62fb56
@ -86,7 +86,8 @@ describe("E2E Tests for Extract API Routes", () => {
|
|||||||
type: "array",
|
type: "array",
|
||||||
items: {
|
items: {
|
||||||
type: "string"
|
type: "string"
|
||||||
}
|
},
|
||||||
|
required: ["items"]
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(response.statusCode).toBe(200);
|
expect(response.statusCode).toBe(200);
|
||||||
|
@ -165,7 +165,9 @@ export async function generateOpenAICompletions(logger: Logger, options: Extract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.schema && options.schema.type === "array") {
|
// If the users actually wants the items object, they can specify it as 'required' in the schema
|
||||||
|
// otherwise, we just return the items array
|
||||||
|
if (options.schema && options.schema.type === "array" && !schema?.required?.includes("items")) {
|
||||||
extract = extract?.items;
|
extract = extract?.items;
|
||||||
}
|
}
|
||||||
return { extract, warning };
|
return { extract, warning };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user