接入 DSH 专用运行时和对话界面,保留模型原始回答,支持会话分页、连续追问与显式报告。 补齐组合筛选、各维度 Top100、分组查询到排名图的转换,图表故障静默省略并基于保存数据自动恢复。 优化报告风格、图表顺序和表格换行,更新接入说明及构建输入。 验证:独立目录前后端构建通过;118 项 Java、102 项前端、102 项图表、14 项 DSH 应用和 13 项组合筛选检查通过。 仅提交相关源码、锁定依赖与测试;不包含凭据、会话、业务数据或本地产物。
30 lines
1.7 KiB
JavaScript
30 lines
1.7 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import ts from 'typescript';
|
|
|
|
const source = fs.readFileSync(new URL('../src/agent/AgentDeliverable.tsx', import.meta.url), 'utf8');
|
|
const start = source.indexOf('export function reportRequested');
|
|
const end = source.indexOf('export function AgentDeliverable(');
|
|
const code = ts.transpileModule(source.slice(start, end).replaceAll('export function', 'function'), {
|
|
compilerOptions: { target: ts.ScriptTarget.ES2022 },
|
|
}).outputText;
|
|
const authoredReport = new Function('analysisSnapshotResult', 'stripDuplicateFirstMarkdownH1', code + '\nreturn authoredReport;')(
|
|
turn => turn.result || turn, text => text,
|
|
);
|
|
|
|
test('a restored clarification answer retains the explicitly requested report and raw body', () => {
|
|
const original = '# 排名报告\n\n模型原始正文';
|
|
const turn = { status: 'COMPLETED', question: '黑片or亮片', modelAnswer: original, reportMarkdown: original,
|
|
task: { aggregateSelection: { requestQuestion: '筛选10月合格率最低Top20产品,并生成报告' } } };
|
|
assert.equal(authoredReport(turn).markdown, original);
|
|
assert.equal(authoredReport({ ...turn, result: { modelAnswer: original, reportMarkdown: original, task: turn.task } }).markdown, original);
|
|
});
|
|
|
|
test('ordinary replies and new requests without an authored report cannot inherit a report card', () => {
|
|
const turn = { status: 'COMPLETED', question: '只回答名单,不生成报告', modelAnswer: '原始回答',
|
|
task: { aggregateSelection: { requestQuestion: '此前要求生成报告' } } };
|
|
assert.equal(authoredReport(turn), null);
|
|
assert.equal(authoredReport({ ...turn, task: {}, reportMarkdown: '原始回答' }), null);
|
|
});
|