Pass along current, total, current_step, and current_url in js sdk

This commit is contained in:
jhoseph88
2024-07-11 19:30:18 -04:00
parent fcc67a3c9e
commit 68828a5b5c
5 changed files with 33 additions and 7 deletions
+12 -2
View File
@@ -157,8 +157,14 @@ export default class FirecrawlApp {
return {
success: true,
status: response.data.status,
current: response.data.current,
current_url: response.data.current_url,
current_step: response.data.current_step,
total: response.data.total,
data: response.data.data,
partial_data: !response.data.data ? response.data.partial_data : undefined,
partial_data: !response.data.data
? response.data.partial_data
: undefined,
};
}
else {
@@ -171,6 +177,10 @@ export default class FirecrawlApp {
return {
success: false,
status: "unknown",
current: 0,
current_url: "",
current_step: "",
total: 0,
error: "Internal server error.",
};
});
@@ -180,7 +190,7 @@ export default class FirecrawlApp {
* @returns {AxiosRequestHeaders} The prepared headers.
*/
prepareHeaders(idempotencyKey) {
return Object.assign({ 'Content-Type': 'application/json', 'Authorization': `Bearer ${this.apiKey}` }, (idempotencyKey ? { 'x-idempotency-key': idempotencyKey } : {}));
return Object.assign({ "Content-Type": "application/json", Authorization: `Bearer ${this.apiKey}` }, (idempotencyKey ? { "x-idempotency-key": idempotencyKey } : {}));
}
/**
* Sends a POST request to the specified URL.