add recursive option for folder-loader
This commit is contained in:
parent
7faaf13ccc
commit
2bb2a7588a
|
|
@ -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,12 @@ 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, {
|
||||
console.log('Recursive: ', recursive)
|
||||
const loader = new DirectoryLoader(
|
||||
folderPath,
|
||||
{
|
||||
'.json': (path) => new JSONLoader(path),
|
||||
'.txt': (path) => new TextLoader(path),
|
||||
'.csv': (path) => new CSVLoader(path),
|
||||
|
|
@ -96,7 +106,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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue