修复:DSH 自主查询、图片直显与报告稳定性

允许 Agent 在循环中查目录、修正查询和提问,保留实时权限检查及模型原始回答。
统一相同查询证据与图表资源;排名补齐阶段指标,修正 OR 重量筛选,并限制模型明细输入。
增加运行恢复、图表自适应坐标轴与两位小数,修复报告主图选择、重复图及边缘标签。

验证:独立副本通过 162 项 Python、73 项前端及 21 项后端测试,前端构建通过。
线上已用原 8 题复测,并追加两轮双期对比;TOP100 与组合筛选分别核对 100 行和 20 行。
This commit is contained in:
2026-11-12 16:14:20 +08:00
parent f1a2fbd494
commit bc19475b29
35 changed files with 983 additions and 114 deletions
+9 -1
View File
@@ -232,7 +232,8 @@ def _protocol_scope_visual_result(evidence, scopes, question, turn_id, *, releas
# "composite plus both stages". Honour that explicit report request
# using only this already scope-checked evidence, never a new query.
requested_text = root.get('question', '')
wants_stages = (all(label in requested_text for label in ('黑片合格率', '亮片合格率'))
quality_overview = bool(re.search(r'(?:总体|综合|整体)质量(?:分析)?报告', requested_text))
wants_stages = (quality_overview or all(label in requested_text for label in ('黑片合格率', '亮片合格率'))
or bool(re.search(r'(?:两阶段|阶段)(?:月度)?对照', requested_text)))
if (root.get('executionMode') == 'native_agent' and root.get('kind') in ('analysis', 'report')
and root.get('trendRequired') is True and preference != 'none' and wants_stages
@@ -273,6 +274,9 @@ def _protocol_scope_visual_result(evidence, scopes, question, turn_id, *, releas
if not matched:
missing.append('节点'+str(node_id)+'范围'+str(scope.get('label') or scope_id)
+'缺少'+str(stage)+'来源具体缺陷重量图,或所选图表类型无法诚实表达该范围。')
if (quality_overview and any(v.get('metric') == 'composite_rate' for v in child_visuals)
and not re.search(r'投入.{0,6}(?:趋势|变化)|产量趋势|重量趋势', requested_text)):
child_visuals = [v for v in child_visuals if v.get('metric') not in ('black_total_weight','bright_total_weight')]
for visual in child_visuals:
if isinstance(visual, dict):
# Keep the established chart wire schema. Node/scope
@@ -289,6 +293,10 @@ def _protocol_scope_visual_result(evidence, scopes, question, turn_id, *, releas
expected = []
stages = task.get('stages') or []
for field in task.get('fields', []):
if (field == 'totalWeight' and quality_overview
and any(v.get('metric') == 'composite_rate' for v in child_visuals)
and not re.search(r'投入.{0,6}(?:趋势|变化)|产量趋势|重量趋势', requested_text)):
continue
if field == 'rate':
expected.extend([('composite_rate', None)] if not stages else
[(stage+'_rate', stage) for stage in stages])