mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-10 07:19:00 +08:00
Nick:
This commit is contained in:
parent
0732997a13
commit
23dfe90baa
@ -202,21 +202,7 @@ export default class FirecrawlApp {
|
|||||||
Authorization: `Bearer ${this.apiKey}`,
|
Authorization: `Bearer ${this.apiKey}`,
|
||||||
} as AxiosRequestHeaders;
|
} as AxiosRequestHeaders;
|
||||||
let jsonData: any = { url, ...params };
|
let jsonData: any = { url, ...params };
|
||||||
if (this.version === 'v0' && jsonData?.extractorOptions?.extractionSchema) {
|
if (jsonData?.extract?.schema) {
|
||||||
let schema = jsonData.extractorOptions.extractionSchema;
|
|
||||||
// Check if schema is an instance of ZodSchema to correctly identify Zod schemas
|
|
||||||
if (schema instanceof z.ZodSchema || schema instanceof z.ZodObject) {
|
|
||||||
schema = zodToJsonSchema(schema);
|
|
||||||
}
|
|
||||||
jsonData = {
|
|
||||||
...jsonData,
|
|
||||||
extractorOptions: {
|
|
||||||
...jsonData.extractorOptions,
|
|
||||||
extractionSchema: schema,
|
|
||||||
mode: jsonData.extractorOptions.mode || "llm-extraction",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
} else if (this.version === 'v1' && jsonData?.extract?.schema) {
|
|
||||||
let schema = jsonData.extract.schema;
|
let schema = jsonData.extract.schema;
|
||||||
|
|
||||||
// Try parsing the schema as a Zod schema
|
// Try parsing the schema as a Zod schema
|
||||||
|
1
apps/js-sdk/firecrawl/types/index.d.ts
vendored
1
apps/js-sdk/firecrawl/types/index.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
import { AxiosResponse, AxiosRequestHeaders } from "axios";
|
import { AxiosResponse, AxiosRequestHeaders } from "axios";
|
||||||
import { TypedEventTarget } from "typescript-event-target";
|
import { TypedEventTarget } from "typescript-event-target";
|
||||||
|
import { z } from "zod";
|
||||||
/**
|
/**
|
||||||
* Configuration interface for FirecrawlApp.
|
* Configuration interface for FirecrawlApp.
|
||||||
* @param apiKey - Optional API key for authentication.
|
* @param apiKey - Optional API key for authentication.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user