forked from AI_team/Philosophy-RAG-demo
🐛 If check for pdf source because try doesn't fail
This commit is contained in:
parent
ab1235bd28
commit
67ba306d3e
@ -61,12 +61,11 @@ class RetGenLangGraph:
|
||||
return pdf_sources
|
||||
|
||||
for doc in self.last_retrieved_docs:
|
||||
try:
|
||||
Path(doc.metadata["source"]).suffix == ".pdf"
|
||||
except KeyError:
|
||||
continue
|
||||
else:
|
||||
source_candidate = doc.metadata["source"]
|
||||
if "source" in doc.metadata and Path(doc.metadata["source"]).suffix.lower() == ".pdf":
|
||||
source = doc.metadata["source"]
|
||||
else:
|
||||
continue
|
||||
|
||||
if source not in pdf_sources:
|
||||
pdf_sources[source] = set()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user