Forgotten lazy import in monitor()

This commit is contained in:
Yiorgis Gozadinos 2025-10-27 11:14:43 +02:00
parent 9f3eb1b79c
commit b87e6d988c
No known key found for this signature in database

View file

@ -8,7 +8,7 @@ from haiku.rag.client import HaikuRAG
from haiku.rag.store.models.document import Document from haiku.rag.store.models.document import Document
if TYPE_CHECKING: if TYPE_CHECKING:
from haiku.rag.reader import FileReader pass
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -46,6 +46,9 @@ class FileWatcher:
await self._delete_document(Path(path)) await self._delete_document(Path(path))
async def refresh(self): async def refresh(self):
# Lazy import to avoid loading docling
from haiku.rag.reader import FileReader
for path in self.paths: for path in self.paths:
for f in Path(path).rglob("**/*"): for f in Path(path).rglob("**/*"):
if f.is_file() and f.suffix in FileReader.extensions: if f.is_file() and f.suffix in FileReader.extensions: