Skip to content

Commit

Permalink
FIX FlowiseAI#2617 Big sites scan error - review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Osman committed Jul 4, 2024
1 parent dca904c commit 387147f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/components/nodes/documentloaders/Cheerio/Cheerio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class Cheerio_DocumentLoaders implements INode {
return docs
} catch (err) {
if (process.env.DEBUG === 'true') options.logger.error(`error in CheerioWebBaseLoader: ${err.message}, on page: ${url}`)
return []
}
}

Expand All @@ -165,17 +166,17 @@ class Cheerio_DocumentLoaders implements INode {
if (process.env.DEBUG === 'true') options.logger.info(`pages: ${JSON.stringify(pages)}, length: ${pages.length}`)
if (!pages || pages.length === 0) throw new Error('No relative links found')
for (const page of pages) {
docs.push(...((await cheerioLoader(page)) || []))
docs.push(...(await cheerioLoader(page)))
}
if (process.env.DEBUG === 'true') options.logger.info(`Finish ${relativeLinksMethod}`)
} else if (selectedLinks && selectedLinks.length > 0) {
if (process.env.DEBUG === 'true')
options.logger.info(`pages: ${JSON.stringify(selectedLinks)}, length: ${selectedLinks.length}`)
for (const page of selectedLinks.slice(0, limit)) {
docs.push(...((await cheerioLoader(page)) || []))
docs.push(...(await cheerioLoader(page)))
}
} else {
docs = (await cheerioLoader(url)) || []
docs = await cheerioLoader(url)
}

if (metadata) {
Expand Down

0 comments on commit 387147f

Please sign in to comment.