diff --git a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py index d3e55fb1a..25705f464 100644 --- a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py +++ b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py @@ -52,11 +52,7 @@ def split(path, all: bool, splitter): chunks = [] for dir, _, filenames in os.walk(path): - if all is False and dir in EXCLUDE_DIRS: - continue - - # Exclude hidden directories - if all is False and dir[0] == ".": + if not all and (dir.startswith(".") or dir in EXCLUDE_DIRS): continue for filename in filenames: