Skip to content

Commit

Permalink
BugFix FlowiseAI#2386: Double quotes are not escaped, flow crashes (F…
Browse files Browse the repository at this point in the history
  • Loading branch information
vinodkiran committed May 21, 2024
1 parent 5733a80 commit 95f1090
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ICommonObject, IDatabaseEntity, INode, INodeData, INodeOptionsValue, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import { DataSource } from 'typeorm'
import { Document } from '@langchain/core/documents'
import { handleEscapeCharacters } from '../../../src'

class DocStore_DocumentLoaders implements INode {
label: string
Expand Down Expand Up @@ -83,12 +84,22 @@ class DocStore_DocumentLoaders implements INode {
const chunks = await appDataSource
.getRepository(databaseEntities['DocumentStoreFileChunk'])
.find({ where: { storeId: selectedStore } })
const output = nodeData.outputs?.output as string

const finalDocs = []
for (const chunk of chunks) {
finalDocs.push(new Document({ pageContent: chunk.pageContent, metadata: JSON.parse(chunk.metadata) }))
}
return finalDocs

if (output === 'document') {
return finalDocs
} else {
let finaltext = ''
for (const doc of finalDocs) {
finaltext += `${doc.pageContent}\n`
}
return handleEscapeCharacters(finaltext, false)
}
}
}

Expand Down

0 comments on commit 95f1090

Please sign in to comment.