Explorar el Código

fix: 增强错误日志记录,添加详细的堆栈跟踪信息以便于调试

zhch158_admin hace 5 días
padre
commit
f7da730070

+ 2 - 0
table_line_generator/backend/api/editor.py

@@ -71,6 +71,8 @@ async def upload_files(
         
     except ValueError as e:
         logger.error(f"上传处理失败: {e}")
+        import traceback
+        logger.error(traceback.format_exc())
         raise HTTPException(status_code=400, detail=str(e))
     except Exception as e:
         logger.exception(f"上传处理异常: {e}")

+ 2 - 2
table_line_generator/core/table_analyzer.py

@@ -232,7 +232,7 @@ class TableAnalyzer:
             'horizontal_lines': horizontal_lines,
             'vertical_lines': vertical_lines,
             'row_height': self.row_height,
-            'col_widths': self.col_widths,
+            'col_widths': [int(round(c)) for c in self.col_widths],
             'table_bbox': self._get_table_bbox(),
             'total_rows': actual_rows,
             'total_cols': actual_cols,
@@ -302,7 +302,7 @@ class TableAnalyzer:
             'horizontal_lines': horizontal_lines,
             'vertical_lines': vertical_lines,
             'row_height': self.row_height,
-            'col_widths': self.col_widths,
+            'col_widths': [int(round(c)) for c in self.col_widths],
             'table_bbox': self._get_table_bbox(),
             'mode': 'fixed',
             'modified_h_lines': [],