Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(docreader): remove default 100-page limit for DOCX parsing

wizardchend5f6c7ba214f
diff --git a/.env.example b/.env.example
index a02abfc41..a593ae2df 100644
--- a/.env.example
+++ b/.env.example
@@ -386,9 +386,9 @@ DOCREADER_ADDR=docreader:50051
# Docreader 连接方式
DOCREADER_TRANSPORT=grpc
-# Docreader 中 DOCX 解析的最大页数,默认 100
-# 用于限制超大 Word 文档的解析开销;超过页数的内容将不会继续解析
-# DOCREADER_DOCX_MAX_PAGES=100
+# Docreader 中 DOCX 解析的最大页数,默认 0(不限制)
+# 设为正整数(如 500)可限制超大 Word 文档的解析开销;超过页数的内容将不会继续解析
+# DOCREADER_DOCX_MAX_PAGES=0
# 如果使用Weaviate作为向量存储,需要配置以下参数
# 注意:容器内访问请使用 service:port(不要用 localhost,也不要用宿主机映射端口)
diff --git a/docreader/config.py b/docreader/config.py
index 7cc7de5ab..11d73cdf4 100644
--- a/docreader/config.py
+++ b/docreader/config.py
@@ -73,7 +73,7 @@ def load_config() -> DocReaderConfig:
* 1024
)
grpc_port = _get_int(["DOCREADER_GRPC_PORT", "PORT"], 50051)
- docx_max_pages = _get_int(["DOCREADER_DOCX_MAX_PAGES"], 100)
+ docx_max_pages = _get_int(["DOCREADER_DOCX_MAX_PAGES"], 0)
external_http_proxy = _get_str(
["DOCREADER_EXTERNAL_HTTP_PROXY", "EXTERNAL_HTTP_PROXY"], ""
diff --git a/docreader/parser/docx_parser.py b/docreader/parser/docx_parser.py
index e334d9317..bd713f805 100644
--- a/docreader/parser/docx_parser.py
+++ b/docreader/parser/docx_parser.py
@@ -97,6 +97,8 @@ class DocxParser(BaseParser):
"""
super().__init__(**kwargs)
self.max_pages = CONFIG.docx_max_pages if max_pages is None else max_pages
+ if self.max_pages <= 0:
+ self.max_pages = 100000 # no limit (matches Docx.__call__ default)
logger.info(f"DocxParser initialized with max_pages={self.max_pages}")
def parse_into_text(self, content: bytes) -> DocumentModel: