RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
refactor: docling parser will close bytes io (#12280)
Stephen Hu0b5d1ebefa58
diff --git a/deepdoc/parser/docling_parser.py b/deepdoc/parser/docling_parser.pyindex 965f82265d..e8df1cfd4e 100644--- a/deepdoc/parser/docling_parser.py+++ b/deepdoc/parser/docling_parser.py@@ -78,14 +78,21 @@ class DoclingParser(RAGFlowPdfParser):def __images__(self, fnm, zoomin: int = 1, page_from=0, page_to=600, callback=None):self.page_from = page_fromself.page_to = page_to+ bytes_io = Nonetry:- opener = pdfplumber.open(fnm) if isinstance(fnm, (str, PathLike)) else pdfplumber.open(BytesIO(fnm))+ if not isinstance(fnm, (str, PathLike)):+ bytes_io = BytesIO(fnm)++ opener = pdfplumber.open(fnm) if isinstance(fnm, (str, PathLike)) else pdfplumber.open(bytes_io)with opener as pdf:pages = pdf.pages[page_from:page_to]self.page_images = [p.to_image(resolution=72 * zoomin, antialias=True).original for p in pages]except Exception as e:self.page_images = []self.logger.exception(e)+ finally:+ if bytes_io:+ bytes_io.close()def _make_line_tag(self,bbox: _BBox) -> str:if bbox is None: