修复:完整展示AI原文并穿插图表,统一运行反馈与变化符号

This commit is contained in:
2026-11-02 12:03:37 +08:00
parent cf8e25a30d
commit 903fa94c00
35 changed files with 1016 additions and 172 deletions
+8 -5
View File
@@ -963,7 +963,7 @@ def _change_chart(document: dict[str, Any], result: dict[str, Any], turn_id: str
note = "黑片与亮片两阶段报废重量之和仅作分组描述,不代表独立投入分母或总体变化贡献。"
elif order == "rate_drop":
title = "合格率变化排名" if stage is None else "分组合格率变化排名"
metric, unit, label, field = "rate_drop_pp", "pp", "合格率下降(pp)", "rateDrop"
metric, unit, label, field = "rate_drop_pp", "pp", "合格率变化(pp)", "rateDrop"
required_fields = (["black_good_weight", "black_total_weight", "bright_good_weight", "bright_total_weight"]
if stage is None else [f"{stage}_good_weight", f"{stage}_total_weight"])
@@ -971,11 +971,14 @@ def _change_chart(document: dict[str, Any], result: dict[str, Any], turn_id: str
raw, ok = _finite_number(row.get(field))
if not ok:
return None, False
return (raw * 100 if raw is not None else None), True
points = -raw * 100 if raw is not None else None
if points is not None and not math.isfinite(points):
return None, False
return points, True
note = "正值表示合格率下降,负值表示改善;百分点取自正式分组率差。"
note = "正值表示本期合格率上升,负值表示下降;变化值为本期减比较期,排序仍沿用正式率降排名。"
if stage is None:
note = "正值表示综合合格率下降,负值表示改善;按正式综合率比较,不作为生产根因。"
note = "正值表示本期综合合格率上升,负值表示下降;变化值为本期减比较期,排序仍沿用正式率降排名,不代表生产根因。"
elif order == 'current_rate':
title = '分组本期合格率排名'
metric = (stage+'_rate') if stage else 'composite_rate'
@@ -1023,7 +1026,7 @@ def _change_chart(document: dict[str, Any], result: dict[str, Any], turn_id: str
title = title.replace("分组", "产品")
if order == "rate_drop":
title = title.replace("合格率变化排名", "合格率降幅线索")
note = "条形末端显示具体变化:正值为下降,负值为改善,单位是百分点。本图只按率降幅排序,未纳入投入规模;少量生产或投入骤变的规格不能仅凭此图认定为重点,需结合分阶段投入与报废增量核查。"
note = "条形末端显示本期减比较期的变化:负值为下降,正值为上升,单位是百分点。本图仍按率降幅排序,未纳入投入规模;少量生产或投入骤变的规格不能仅凭此图认定为重点,需结合分阶段投入与报废增量核查。"
elif result["dimension"] == "group":
title = title.replace("分组", "业务分组")
else: