mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 15:52:34 +00:00
fixed logic
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user