fixed logic

This commit is contained in:
Lorenze Jay
2024-12-15 22:48:45 -08:00
parent 610ea40c2d
commit f1c9caa8ec

View File

@@ -39,11 +39,12 @@ class DoclingSource(BaseFileKnowledgeSource):
) )
self.content = self.load_content() self.content = self.load_content()
def load_content(self): def load_content(self) -> List[DoclingDocument] | None:
try: try:
self.content = self.convert_source_to_docling_documents() return self.convert_source_to_docling_documents()
except Exception as e: except Exception as e:
self._logger.log("error", f"Error loading content: {e}") self._logger.log("error", f"Error loading content: {e}")
return None
def add(self) -> None: def add(self) -> None:
if self.content is None: if self.content is None:
@@ -76,7 +77,7 @@ class DoclingSource(BaseFileKnowledgeSource):
except Exception as e: except Exception as e:
raise ValueError(f"Invalid URL: {path}. Error: {str(e)}") raise ValueError(f"Invalid URL: {path}. Error: {str(e)}")
else: else:
local_path = Path(KNOWLEDGE_DIRECTORY).joinpath(path) local_path = Path(KNOWLEDGE_DIRECTORY + "/" + path)
if local_path.exists(): if local_path.exists():
processed_paths.append(local_path) processed_paths.append(local_path)
else: else: