mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-24 21:41:04 +02:00
fix: keep the file extension in SDK doc_name, matching legacy and cloud
Parsers used path.stem, so the same file was named 'report' in SDK local mode but 'report.pdf' in the legacy path and cloud mode; docs differing only by extension became indistinguishable to the selection agent.
This commit is contained in:
parent
457bf1838b
commit
d1824e4d6e
2 changed files with 2 additions and 2 deletions
|
|
@ -24,7 +24,7 @@ class MarkdownParser:
|
|||
headers = self._extract_headers(lines)
|
||||
nodes = self._build_nodes(headers, lines, model, doc_title=path.stem)
|
||||
|
||||
return ParsedDocument(doc_name=path.stem, nodes=nodes,
|
||||
return ParsedDocument(doc_name=path.name, nodes=nodes,
|
||||
metadata={"line_count": len(lines)})
|
||||
|
||||
def _extract_headers(self, lines: list[str]) -> list[dict]:
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class PdfParser:
|
|||
images=images,
|
||||
))
|
||||
|
||||
return ParsedDocument(doc_name=path.stem, nodes=nodes,
|
||||
return ParsedDocument(doc_name=path.name, nodes=nodes,
|
||||
metadata={"page_count": len(reader.pages)})
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue