localGPT icon indicating copy to clipboard operation
localGPT copied to clipboard

Subfolders in source doc

Open kolergy opened this issue 2 years ago • 1 comments

Add ability to have sub-folders in the SOURCE_DOCUMENT folder so you can copy paste your documents with their organization with out the need to flatten them.

kolergy avatar Jul 23 '23 08:07 kolergy

Looks like this has been taken care of in ingest.py:

def load_documents(source_dir: str) -> list[Document]:
    # Loads all documents from the source documents directory, including nested folders
    paths = []
    for root, _, files in os.walk(source_dir):
        for file_name in files:
            print('Importing: ' + file_name)
            file_extension = os.path.splitext(file_name)[1]
            source_file_path = os.path.join(root, file_name)
            if file_extension in DOCUMENT_MAP.keys():
                paths.append(source_file_path)

fvaneijk avatar Jan 06 '24 12:01 fvaneijk