diff --git a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py index 8fdffba66..ca4858deb 100644 --- a/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py +++ b/packages/jupyter-ai/jupyter_ai/chat_handlers/learn.py @@ -133,7 +133,9 @@ def _build_list_response(self): {dir_list}""" return message - async def learn_dir(self, path: str, chunk_size: int, chunk_overlap: int, all: bool): + async def learn_dir( + self, path: str, chunk_size: int, chunk_overlap: int, all: bool + ): dask_client = await self.dask_client_future splitter_kwargs = {"chunk_size": chunk_size, "chunk_overlap": chunk_overlap} splitters = { diff --git a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py index ea4db8b42..d3e55fb1a 100644 --- a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py +++ b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py @@ -17,6 +17,7 @@ def path_to_doc(path): metadata = {"path": str(path), "sha256": m.digest(), "extension": path.suffix} return Document(page_content=text, metadata=metadata) + # Unless /learn has the "all files" option passed in, files and directories beginning with '.' are excluded EXCLUDE_DIRS = { "node_modules", @@ -55,7 +56,7 @@ def split(path, all: bool, splitter): continue # Exclude hidden directories - if all is False and dir[0] == '.': + if all is False and dir[0] == ".": continue for filename in filenames: @@ -64,7 +65,7 @@ def split(path, all: bool, splitter): continue # Unless we're learning "all" files, exclude hidden files - if all is False and filepath.name[0] == '.': + if all is False and filepath.name[0] == ".": continue document = dask.delayed(path_to_doc)(filepath)