fix(api): playground scrape errors
This commit is contained in:
parent
8d44cb33bb
commit
e98f858eb6
|
@ -244,7 +244,7 @@ export async function scrapeController(req: Request, res: Response) {
|
|||
}
|
||||
if (creditsToBeBilled > 0) {
|
||||
// billing for doc done on queue end, bill only for llm extraction
|
||||
billTeam(team_id, chunk.sub_id, creditsToBeBilled).catch(error => {
|
||||
billTeam(team_id, chunk?.sub_id, creditsToBeBilled).catch(error => {
|
||||
Logger.error(`Failed to bill team ${team_id} for ${creditsToBeBilled} credits: ${error}`);
|
||||
// Optionally, you could notify an admin or add to a retry queue here
|
||||
});
|
||||
|
|
|
@ -170,7 +170,7 @@ export async function searchController(req: Request, res: Response) {
|
|||
jobId,
|
||||
req,
|
||||
team_id,
|
||||
chunk.sub_id,
|
||||
chunk?.sub_id,
|
||||
crawlerOptions,
|
||||
pageOptions,
|
||||
searchOptions,
|
||||
|
|
|
@ -152,7 +152,7 @@ export async function mapController(
|
|||
// remove duplicates that could be due to http/https or www
|
||||
links = removeDuplicateUrls(links);
|
||||
|
||||
billTeam(req.auth.team_id, req.acuc.sub_id, 1).catch((error) => {
|
||||
billTeam(req.auth.team_id, req.acuc?.sub_id, 1).catch((error) => {
|
||||
Logger.error(
|
||||
`Failed to bill team ${req.auth.team_id} for 1 credit: ${error}`
|
||||
);
|
||||
|
|
|
@ -108,7 +108,7 @@ export async function scrapeController(
|
|||
creditsToBeBilled = 5;
|
||||
}
|
||||
|
||||
billTeam(req.auth.team_id, req.acuc.sub_id, creditsToBeBilled).catch(error => {
|
||||
billTeam(req.auth.team_id, req.acuc?.sub_id, creditsToBeBilled).catch(error => {
|
||||
Logger.error(`Failed to bill team ${req.auth.team_id} for ${creditsToBeBilled} credits: ${error}`);
|
||||
// Optionally, you could notify an admin or add to a retry queue here
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue