修复: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
+12 -1
View File
@@ -1,6 +1,6 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { agentReportVisuals, buildAgentReportLayout, agentReportPrimary, agentReportChartWidth, agentReportSupplementary } from '../src/agent/agentReportLayout.ts';
import { agentReportVisuals, buildAgentReportLayout, agentReportPrimary, agentReportChartWidth, agentReportSupplementary, partitionAgentReportVisuals } from '../src/agent/agentReportLayout.ts';
import { parseAnalysisVisuals } from '../src/analysisVisualsModel.ts';
const trend = (metric, scope = {}, values = [.9515, .9529, .9546]) => ({
@@ -194,3 +194,14 @@ test('an available Top10 snapshot displays the requested Top5 without changing s
assert.equal(figures[1].categories.length,4);assert.equal(JSON.stringify([ten,pie]),before);
assert.equal(parseAnalysisVisuals([figures[0]],1).visuals[0]?.chartable,true,'the cropped visual must remain renderable by the export parser');
});
test('report primary and supplementary lists cannot render the same image twice', () => {
const black = {...trend('black_total_weight'),unit:'kg'};
const bright = {...trend('bright_total_weight'),unit:'kg'};
const inputs = [black,bright,black];
const {primary,secondary,supplemental}=partitionAgentReportVisuals(inputs,'总体质量分析报告,重点展示月度趋势和黑片亮片报废结构');
const all=[primary,...secondary,...supplemental].filter(Boolean);
assert.equal(all.length,2);
assert.equal(new Set(all.map(v=>v.id)).size,2);
assert.equal(agentReportSupplementary(primary,inputs,'总体质量分析报告,重点展示月度趋势和黑片亮片报废结构'),false);
});