mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 02:18:59 +08:00
feat(search): bill for PDFs properly
This commit is contained in:
parent
a2f41fb650
commit
a8e0482718
@ -255,7 +255,13 @@ export async function searchController(
|
||||
}
|
||||
|
||||
// Bill team once for all successful results
|
||||
billTeam(req.auth.team_id, req.acuc?.sub_id, responseData.data.length).catch((error) => {
|
||||
billTeam(req.auth.team_id, req.acuc?.sub_id, responseData.data.reduce((a,x) => {
|
||||
if (x.metadata?.numPages !== undefined && x.metadata.numPages > 0) {
|
||||
return a + x.metadata.numPages;
|
||||
} else {
|
||||
return a + 1;
|
||||
}
|
||||
}, 0)).catch((error) => {
|
||||
logger.error(
|
||||
`Failed to bill team ${req.auth.team_id} for ${responseData.data.length} credits: ${error}`,
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user