feat:LLM 分析文件并生成结构化建议

This commit is contained in:
2026-10-10 06:07:56 -07:00
parent b90842237f
commit e3699d1a30
22 changed files with 457 additions and 327 deletions
+8 -1
View File
@@ -1,4 +1,6 @@
"""数据文件各环节共用的异常和上限"""
"""数据文件各环节共用的异常、上限和警告文案的写法"""
from collections.abc import Sequence
# 每张表的数据行数上限
MAX_TABLE_ROWS = 1_000_000
@@ -26,6 +28,11 @@ def where(sheet: str | None) -> str:
return f"{sheet}:" if sheet else ""
def brief(items: Sequence[str], sep: str = "、", limit: int = 5) -> str:
"""警告里列举的内容最多写 limit 个,多出的用“等”概括"""
return sep.join(items[:limit]) + ("等" if len(items) > limit else "")
def rows_exceeded(sheet: str | None) -> DataFileError:
return DataFileError(
422, f"{where(sheet)}超过 {MAX_TABLE_ROWS // 10_000} 万行,请拆分后上传"