fix: 五轮修正失败根因修复 - 评分公式去掉field_coverage权重, namespace无条件检查, OCR自动发现文档类型

This commit is contained in:
2026-05-24 22:44:37 +08:00
parent f25a93b539
commit 520c8b19d0
3 changed files with 9 additions and 5 deletions
+3 -3
View File
@@ -1317,9 +1317,9 @@ def _check_ocr_fidelity(jrxml: str, state: dict) -> dict:
f"OCR 布局分析有 {ocr_columns}"
)
# 综合评分(元素覆盖为主权重 0.8,字段覆盖为辅助 0.2
# 英文字段名 vs 中文 OCR 字段名天然不匹配是预期行为,字段覆盖仅作参考
score = round(element_coverage * 0.8 + field_coverage * 0.2, 3)
# 综合评分(只依赖元素覆盖,字段名语言不匹配是预期行为
# field_coverage 仅作信息提示,不参与评分计算
score = round(element_coverage, 3)
return {
"score": score,
"field_coverage": round(field_coverage, 3),
+5 -1
View File
@@ -4,7 +4,11 @@ JRXML 必须兼容 JasperReports 7.0.6 schema。
关键规则:
- 只输出 JRXML 代码,不要解释,不要 markdown 标记。
- 报表正文中使用的每个字段必须在 <field name="..."> 部分中声明。
- 根元素为 <jasperReport>,包含正确的 xmlns 属性。
- 根元素为 <jasperReport>,包含正确的 xmlns 属性。**禁止在元素标签上使用 ns0: 前缀**。正确的根元素格式:
```xml
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd">
```
删除所有 `xmlns:ns0` 声明,删除所有元素标签上的 `ns0:` 前缀。
- 包含 <queryString>,在 <![CDATA[...]]> 中包含 SQL 查询。
- 确保所有交叉引用(字段名称、band 元素)保持一致。
+1 -1
View File
@@ -5,7 +5,7 @@
- 使用 $F{{field_1}}, $F{{field_2}}, ... 作为占位字段名,并在 <field> 部分声明它们。
- 报表结构必须正确(title, pageHeader, columnHeader, detail, pageFooter 等 band)。
- 元素位置使用近似值即可,后续会精确调整。
- 根元素为 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd">,命名空间和 schemaLocation 必须精确,不可使用其他 URL(如 jaspersoft.com)。
- 根元素为 <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd">,命名空间和 schemaLocation 必须精确,不可使用其他 URL(如 jaspersoft.com)。**禁止在元素标签上使用 ns0: 前缀**。
- 包含 <queryString>,在 <![CDATA[...]]> 中放置占位 SQLSELECT * FROM table_name)。
- 确保 JRXML 兼容 JasperReports 7.0.6。