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:
Ray 2026-07-21 18:46:15 +08:00
parent 457bf1838b
commit d1824e4d6e
2 changed files with 2 additions and 2 deletions

View file

@ -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]:

View file

@ -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