Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Update index.ts

Nicolas4eacdb0aad9c
diff --git a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
index 7ce8ff153..f0c3c4076 100644
--- a/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
+++ b/apps/api/src/scraper/scrapeURL/engines/pdf/index.ts
@@ -36,19 +36,21 @@ async function scrapePDFWithRunPodMU(
tempFilePath,
});
- try {
- const cachedResult = await getPdfResultFromCache(base64Content);
- if (cachedResult) {
- meta.logger.info("Using cached RunPod MU result for PDF", {
+ if (!maxPages) {
+ try {
+ const cachedResult = await getPdfResultFromCache(base64Content);
+ if (cachedResult) {
+ meta.logger.info("Using cached RunPod MU result for PDF", {
+ tempFilePath,
+ });
+ return cachedResult;
+ }
+ } catch (error) {
+ meta.logger.warn("Error checking PDF cache, proceeding with RunPod MU", {
+ error,
tempFilePath,
});
- return cachedResult;
}
- } catch (error) {
- meta.logger.warn("Error checking PDF cache, proceeding with RunPod MU", {
- error,
- tempFilePath,
- });
}
meta.abort.throwIfAborted();