mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
fix totalChars accumulator for undefined pageContent (#2619)
This commit is contained in:
@@ -600,7 +600,12 @@ const _saveChunksToStorage = async (data: IDocumentStoreLoaderForPreview, entity
|
|||||||
await appServer.AppDataSource.getRepository(DocumentStoreFileChunk).delete({ docId: newLoaderId })
|
await appServer.AppDataSource.getRepository(DocumentStoreFileChunk).delete({ docId: newLoaderId })
|
||||||
if (response.chunks) {
|
if (response.chunks) {
|
||||||
//step 8: now save the new chunks
|
//step 8: now save the new chunks
|
||||||
const totalChars = response.chunks.reduce((acc: number, chunk) => acc + chunk.pageContent.length, 0)
|
const totalChars = response.chunks.reduce((acc, chunk) => {
|
||||||
|
if (chunk.pageContent) {
|
||||||
|
return acc + chunk.pageContent.length
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, 0)
|
||||||
response.chunks.map(async (chunk: IDocument, index: number) => {
|
response.chunks.map(async (chunk: IDocument, index: number) => {
|
||||||
const docChunk: DocumentStoreFileChunk = {
|
const docChunk: DocumentStoreFileChunk = {
|
||||||
docId: newLoaderId,
|
docId: newLoaderId,
|
||||||
|
|||||||
Reference in New Issue
Block a user