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
Fix: parsing excel with chartsheet & Clamp begin to a minimum of 0 to prevent negative indexing (#10819)
Billy Baoe59458c36bd8
diff --git a/deepdoc/parser/excel_parser.py b/deepdoc/parser/excel_parser.pyindex 4d0496a33f..868fc5f41c 100644--- a/deepdoc/parser/excel_parser.py+++ b/deepdoc/parser/excel_parser.py@@ -123,7 +123,12 @@ class RAGFlowExcelParser:for sheetname in wb.sheetnames:ws = wb[sheetname]- rows = list(ws.rows)+ try:+ rows = list(ws.rows)+ except Exception as e:+ logging.warning(f"Skip sheet '{sheetname}' due to rows access error: {e}")+ continue+if not rows:continue@@ -170,7 +175,11 @@ class RAGFlowExcelParser:res = []for sheetname in wb.sheetnames:ws = wb[sheetname]- rows = list(ws.rows)+ try:+ rows = list(ws.rows)+ except Exception as e:+ logging.warning(f"Skip sheet '{sheetname}' due to rows access error: {e}")+ continueif not rows:continueti = list(rows[0])@@ -193,9 +202,14 @@ class RAGFlowExcelParser:if fnm.split(".")[-1].lower().find("xls") >= 0:wb = RAGFlowExcelParser._load_excel_to_workbook(BytesIO(binary))total = 0+for sheetname in wb.sheetnames:- ws = wb[sheetname]- total += len(list(ws.rows))+ try:+ ws = wb[sheetname]+ total += len(list(ws.rows))+ except Exception as e:+ logging.warning(f"Skip sheet '{sheetname}' due to rows access error: {e}")+ continuereturn totalif fnm.split(".")[-1].lower() in ["csv", "txt"]:diff --git a/rag/app/table.py b/rag/app/table.pyindex b0c3e5bc2c..7a21a738aa 100644--- a/rag/app/table.py+++ b/rag/app/table.py@@ -15,6 +15,7 @@#import copy+import loggingimport refrom io import BytesIOfrom xpinyin import Pinyin@@ -44,7 +45,11 @@ class Excel(ExcelParser):rn = 0for sheetname in wb.sheetnames:ws = wb[sheetname]- rows = list(ws.rows)+ try:+ rows = list(ws.rows)+ except Exception as e:+ logging.warning(f"Skip sheet '{sheetname}' due to rows access error: {e}")+ continueif not rows:continueheaders, header_rows = self._parse_headers(ws, rows)diff --git a/rag/nlp/search.py b/rag/nlp/search.pyindex 4256a638d2..ecb22522fd 100644--- a/rag/nlp/search.py+++ b/rag/nlp/search.py@@ -395,7 +395,9 @@ class Dealer:tsim = simvsim = sim# Already paginated in search function- begin = ((page % (RERANK_LIMIT//page_size)) - 1) * page_size+ max_pages = RERANK_LIMIT // page_size+ page_index = (page % max_pages) - 1+ begin = max(page_index * page_size, 0)sim = sim[begin : begin + page_size]sim_np = np.array(sim)idx = np.argsort(sim_np * -1)