Nick: fixed the batch scrape + llm extract billing
Some checks are pending
Deploy Images to GHCR / push-app-image (push) Waiting to run

This commit is contained in:
Nicolas 2024-10-28 17:04:42 -03:00
parent 726430c2e6
commit 0bad436061

View File

@ -121,8 +121,13 @@ export async function runWebScraper({
: docs;
if(is_scrape === false) {
billTeam(team_id, undefined, filteredDocs.length).catch(error => {
Logger.error(`Failed to bill team ${team_id} for ${filteredDocs.length} credits: ${error}`);
let creditsToBeBilled = 1; // Assuming 1 credit per document
if (extractorOptions && (extractorOptions.mode === "llm-extraction" || extractorOptions.mode === "extract")) {
creditsToBeBilled = 5;
}
billTeam(team_id, undefined, creditsToBeBilled * filteredDocs.length).catch(error => {
Logger.error(`Failed to bill team ${team_id} for ${creditsToBeBilled * filteredDocs.length} credits: ${error}`);
// Optionally, you could notify an admin or add to a retry queue here
});
}