mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 13:01:14 +03:00
Merge pull request #1688 from ill-yes/bugfix/folder_recursive
add recursive option for folder-loader
This commit is contained in:
@@ -34,6 +34,12 @@ class Folder_DocumentLoaders implements INode {
|
||||
type: 'string',
|
||||
placeholder: ''
|
||||
},
|
||||
{
|
||||
label: 'Recursive',
|
||||
name: 'recursive',
|
||||
type: 'boolean',
|
||||
additionalParams: false
|
||||
},
|
||||
{
|
||||
label: 'Text Splitter',
|
||||
name: 'textSplitter',
|
||||
@@ -54,8 +60,11 @@ class Folder_DocumentLoaders implements INode {
|
||||
const textSplitter = nodeData.inputs?.textSplitter as TextSplitter
|
||||
const folderPath = nodeData.inputs?.folderPath as string
|
||||
const metadata = nodeData.inputs?.metadata
|
||||
const recursive = nodeData.inputs?.recursive as boolean
|
||||
|
||||
const loader = new DirectoryLoader(folderPath, {
|
||||
const loader = new DirectoryLoader(
|
||||
folderPath,
|
||||
{
|
||||
'.json': (path) => new JSONLoader(path),
|
||||
'.txt': (path) => new TextLoader(path),
|
||||
'.csv': (path) => new CSVLoader(path),
|
||||
@@ -96,7 +105,9 @@ class Folder_DocumentLoaders implements INode {
|
||||
'.html': (path) => new TextLoader(path), // HTML
|
||||
'.vb': (path) => new TextLoader(path), // Visual Basic
|
||||
'.xml': (path) => new TextLoader(path) // XML
|
||||
})
|
||||
},
|
||||
recursive
|
||||
)
|
||||
let docs = []
|
||||
|
||||
if (textSplitter) {
|
||||
|
||||
Reference in New Issue
Block a user