mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-14 15:35:54 +08:00
Nick: links-billed update (temp)
This commit is contained in:
parent
363021ea78
commit
aa31508ccd
@ -5,3 +5,7 @@ export const extractConfig = {
|
|||||||
FALLBACK_SCORE_THRESHOLD: 0.5,
|
FALLBACK_SCORE_THRESHOLD: 0.5,
|
||||||
MIN_REQUIRED_LINKS: 1,
|
MIN_REQUIRED_LINKS: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CUSTOM_U_TEAMS = [
|
||||||
|
"874d40cc-a5c0-4e93-b661-9ddfbad5e51e"
|
||||||
|
]
|
@ -10,6 +10,7 @@ import { logJob } from "../../services/logging/log_job";
|
|||||||
import { _addScrapeJobToBullMQ } from "../../services/queue-jobs";
|
import { _addScrapeJobToBullMQ } from "../../services/queue-jobs";
|
||||||
import { saveCrawl, StoredCrawl } from "../crawl-redis";
|
import { saveCrawl, StoredCrawl } from "../crawl-redis";
|
||||||
import { updateExtract } from "./extract-redis";
|
import { updateExtract } from "./extract-redis";
|
||||||
|
import { CUSTOM_U_TEAMS } from "./config";
|
||||||
|
|
||||||
interface ExtractServiceOptions {
|
interface ExtractServiceOptions {
|
||||||
request: ExtractRequest;
|
request: ExtractRequest;
|
||||||
@ -182,10 +183,15 @@ export async function performExtraction(extractId: string, options: ExtractServi
|
|||||||
// }, {}, crypto.randomUUID(), 50);
|
// }, {}, crypto.randomUUID(), 50);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
let linksBilled = links.length * 5;
|
||||||
|
|
||||||
|
if(CUSTOM_U_TEAMS.includes(teamId)){
|
||||||
|
linksBilled = 1;
|
||||||
|
}
|
||||||
// Bill team for usage
|
// Bill team for usage
|
||||||
billTeam(teamId, subId, links.length * 5).catch((error) => {
|
billTeam(teamId, subId, linksBilled).catch((error) => {
|
||||||
logger.error(
|
logger.error(
|
||||||
`Failed to bill team ${teamId} for ${links.length * 5} credits: ${error}`,
|
`Failed to bill team ${teamId} for ${linksBilled} credits: ${error}`,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user