cleaner refactor

This commit is contained in:
Lorenze Jay
2024-12-03 12:18:07 -08:00
parent 7e93285df1
commit 8b1aef9e2d
6 changed files with 24 additions and 46 deletions

View File

@@ -10,10 +10,8 @@ class JSONKnowledgeSource(BaseFileKnowledgeSource):
def load_content(self) -> Dict[Path, str]:
"""Load and preprocess JSON file content."""
paths = [self.file_path] if isinstance(self.file_path, Path) else self.file_path
content: Dict[Path, str] = {}
for path in paths:
for path in self.safe_file_paths:
path = self.convert_to_path(path)
with open(path, "r", encoding="utf-8") as json_file:
data = json.load(json_file)