Skip to content

Commit faa33a0

Browse files
committed
fix paper_meta fetch locally
1 parent 95729b1 commit faa33a0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

python/graphy/apps/paper_reading/paper_reading_nodes.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def from_dict(
152152
return cls(name, graph, llm_model, embeddings_model, vectordb, persist_store)
153153

154154
def pre_execute(self, state: Dict[str, Any], input: DataType) -> DataType | None:
155-
paper_file_path = input.get("paper_file_path", None)
156-
paper_meta_path = input.get("paper_meta_path", None)
155+
paper_file_path: str = input.get("paper_file_path", "")
156+
paper_meta_path: str = input.get("paper_meta_path", "")
157157
# Uncomment these if you want to move the output directory to a different location
158158
# paper_file_path = change_path(paper_file_path)
159159
# paper_meta_path = change_path(paper_meta_path)
@@ -163,6 +163,14 @@ def pre_execute(self, state: Dict[str, Any], input: DataType) -> DataType | None
163163
if not paper_meta_path:
164164
return None
165165

166+
if not paper_meta_path and "_NAVIGATOR" in paper_file_path:
167+
paper_meta_path = paper_file_path.replace(
168+
"_NAVIGATOR", "_META_FOLDER"
169+
).replace(".pdf", ".json")
170+
171+
if not os.path.exists(paper_meta_path):
172+
paper_meta_path = ""
173+
166174
data_id = None
167175
# Initialize the paper extractor and other components
168176
pdf_extractor = PaperExtractor(paper_file_path, meta_path=paper_meta_path)

0 commit comments

Comments
 (0)