Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
fix(api): playground scrape errors
Gergő Móricze98f858eb6ad
diff --git a/apps/api/src/controllers/v0/scrape.ts b/apps/api/src/controllers/v0/scrape.tsindex db304fed1..2a0fcc137 100644--- a/apps/api/src/controllers/v0/scrape.ts+++ b/apps/api/src/controllers/v0/scrape.ts@@ -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});diff --git a/apps/api/src/controllers/v0/search.ts b/apps/api/src/controllers/v0/search.tsindex 2d8c69deb..648706059 100644--- a/apps/api/src/controllers/v0/search.ts+++ b/apps/api/src/controllers/v0/search.ts@@ -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,diff --git a/apps/api/src/controllers/v1/map.ts b/apps/api/src/controllers/v1/map.tsindex aca03ced7..cc5f6aa3f 100644--- a/apps/api/src/controllers/v1/map.ts+++ b/apps/api/src/controllers/v1/map.ts@@ -152,7 +152,7 @@ export async function mapController(// remove duplicates that could be due to http/https or wwwlinks = 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}`);diff --git a/apps/api/src/controllers/v1/scrape.ts b/apps/api/src/controllers/v1/scrape.tsindex 419749176..899ae74af 100644--- a/apps/api/src/controllers/v1/scrape.ts+++ b/apps/api/src/controllers/v1/scrape.ts@@ -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});