统一:DSH 智能分析、Top100 与图表静默恢复
接入 DSH 专用运行时和对话界面,保留模型原始回答,支持会话分页、连续追问与显式报告。 补齐组合筛选、各维度 Top100、分组查询到排名图的转换,图表故障静默省略并基于保存数据自动恢复。 优化报告风格、图表顺序和表格换行,更新接入说明及构建输入。 验证:独立目录前后端构建通过;118 项 Java、102 项前端、102 项图表、14 项 DSH 应用和 13 项组合筛选检查通过。 仅提交相关源码、锁定依赖与测试;不包含凭据、会话、业务数据或本地产物。
This commit is contained in:
@@ -5,29 +5,22 @@ import fs from 'node:fs';
|
||||
import ts from 'typescript';
|
||||
import React from 'react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { parseServerReadingSummary } from '../src/analysisReadingModel.ts';
|
||||
import {
|
||||
analysisMemberListFullyRead,
|
||||
analysisMemberListPeriod,
|
||||
parseAnalysisMemberList,
|
||||
} from '../src/analysisMembersModel.ts';
|
||||
|
||||
const exportSource = fs.readFileSync(new URL('../src/AnalysisReportExport.tsx', import.meta.url), 'utf8');
|
||||
const reportDocumentSource = exportSource.slice(exportSource.indexOf('function ReportDocument('), exportSource.indexOf('\nfunction reportHtmlFromElement('));
|
||||
const node = (tag, props) => React.createElement(tag, props, props?.children);
|
||||
const ReportDocument = new Function('tableTextAlignment', 'React', 'reportCss', 'record', 'text', 'buildAnalysisNarrative', 'analysisScopeText',
|
||||
'parseServerReadingSummary', 'resolveAnalysisReportTitle', 'sanitizeAnalysisDisplayText', 'stripDuplicateFirstMarkdownH1', 'AnalysisReportNarrative',
|
||||
'AnalysisLegacyResults', 'AnalysisRecordListReport', 'analysisMemberListFullyRead', 'analysisMemberListPeriod', 'parseAnalysisMemberList',
|
||||
ts.transpileModule(`${reportDocumentSource}\nreturn ReportDocument;`, {
|
||||
fileName: 'analysis-report-document.tsx',
|
||||
const source = fs.readFileSync(new URL('../src/AnalysisMemberListReport.tsx', import.meta.url), 'utf8');
|
||||
const script = source.replace(/^import .+;\n/gm, '').replace('export function ', 'function ');
|
||||
const ReportDocument = new Function('tableTextAlignment', 'React',
|
||||
'analysisMemberListFullyRead', 'analysisMemberListPeriod', 'parseAnalysisMemberList',
|
||||
ts.transpileModule(`${script}
|
||||
return AnalysisMemberListReport;`, {
|
||||
fileName: 'analysis-member-report.tsx',
|
||||
compilerOptions: { target: ts.ScriptTarget.ES2022, jsx: ts.JsxEmit.React },
|
||||
}).outputText
|
||||
)(tableTextAlignment, React, '', value => value && typeof value === 'object' && !Array.isArray(value) ? value : {},
|
||||
value => value === null || value === undefined || value === '' ? '—' : String(value),
|
||||
() => ({ period: '2026年9月' }), () => '', parseServerReadingSummary, () => '分析报告', value => value, value => value,
|
||||
({ answer }) => node('div', { className: 'report-summary', children: answer }), () => null, () => null,
|
||||
analysisMemberListFullyRead, analysisMemberListPeriod, parseAnalysisMemberList);
|
||||
|
||||
)(tableTextAlignment, React, analysisMemberListFullyRead, analysisMemberListPeriod, parseAnalysisMemberList);
|
||||
function memberListFixture() {
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
@@ -46,8 +39,7 @@ function memberListFixture() {
|
||||
|
||||
test('the report includes every member row beyond the former 150-row limit as a static escaped table', () => {
|
||||
const html = renderToStaticMarkup(React.createElement(ReportDocument, {
|
||||
turn: { id: 'turn-1', status: 'COMPLETED', result: { answer: '摘要内容', memberList: memberListFixture() } },
|
||||
stamp: '2026-10-27 12:00:00', visualImages: [],
|
||||
value: memberListFixture(),
|
||||
}));
|
||||
|
||||
assert.match(html, /<h2>成员清单<\/h2>/);
|
||||
@@ -71,8 +63,7 @@ test('the report accepts a root memberList and labels incomplete coverage', () =
|
||||
source.rowsReturned = 160;
|
||||
source.queryComplete = false;
|
||||
const html = renderToStaticMarkup(React.createElement(ReportDocument, {
|
||||
turn: { id: 'turn-2', status: 'PARTIAL', answer: '摘要', memberList: source },
|
||||
stamp: '2026-10-27 12:00:00', visualImages: [],
|
||||
value: source,
|
||||
}));
|
||||
assert.equal((html.match(/<tr/g) || []).length, 161);
|
||||
assert.match(html, /读取未完成 160 \/ 181 条/);
|
||||
|
||||
Reference in New Issue
Block a user