Преглед на файлове

filter excel empty sheet (#8194)

Jyong преди 7 месеца
родител
ревизия
af92f19291
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      api/core/rag/extractor/excel_extractor.py

+ 4 - 1
api/core/rag/extractor/excel_extractor.py

@@ -38,7 +38,10 @@ class ExcelExtractor(BaseExtractor):
             for sheet_name in wb.sheetnames:
                 sheet = wb[sheet_name]
                 data = sheet.values
-                cols = next(data)
+                try:
+                    cols = next(data)
+                except StopIteration:
+                    continue
                 df = pd.DataFrame(data, columns=cols)
 
                 df.dropna(how='all', inplace=True)