统一全系统资源加载、轻量趋势与缓存恢复

This commit is contained in:
2026-11-02 09:54:01 +08:00
parent 8b8f9b7728
commit b711327c8e
58 changed files with 3150 additions and 661 deletions
+6 -3
View File
@@ -18,6 +18,7 @@ import { resolveAnalysisReportTitle, stripDuplicateFirstMarkdownH1 } from './ana
import { useReportVisualImages, type ReportVisualImage } from './AnalysisReportVisuals';
import { analysisMemberListFullyRead, analysisMemberListPeriod, parseAnalysisMemberList } from './analysisMembersModel';
import { AnalysisRecordListReport, appendAnalysisRecordReportHtml } from './AnalysisRecordList';
import { useDelayedIndicator } from './useDelayedBusy';
type Row = Record<string, unknown>;
const record = (value: unknown): Row => value && typeof value === 'object' && !Array.isArray(value) ? value as Row : {};
@@ -219,6 +220,7 @@ function ReportExportDialog({ turn, reportMarkdown, reportHtml, native = false }
}) {
const [open, setOpen] = useState(false);
const [exporting, setExporting] = useState(false);
const showExporting = useDelayedIndicator(exporting, 150);
const [progress, setProgress] = useState('');
const [error, setError] = useState('');
const [stamp, setStamp] = useState('');
@@ -239,6 +241,7 @@ function ReportExportDialog({ turn, reportMarkdown, reportHtml, native = false }
const currentExport = useRef({ open, turnId, snapshot, reportHtml, reportMarkdown });
currentExport.current = { open, turnId, snapshot, reportHtml, reportMarkdown };
const visualReport = useReportVisualImages(turn, open);
const showVisualLoading = useDelayedIndicator(visualReport.loading, 150);
const safeHtml = useMemo(() => {
if (parseServerReadingSummary(reportTurn)) return '';
if (!reportHtml?.trim()) return '';
@@ -358,10 +361,10 @@ function ReportExportDialog({ turn, reportMarkdown, reportHtml, native = false }
: <Button disabled={disabled} onClick={() => void saveHtml()}>下载 HTML</Button>}
{prepared
? <Button type="primary" disabled={disabled} onClick={() => void downloadPrepared(prepared, 'image')}>下载长图</Button>
: <Button type="primary" loading={exporting} disabled={disabled} onClick={() => void prepareImages()}>下载长图</Button>}
: <Button type="primary" loading={showExporting} disabled={disabled} onClick={() => void prepareImages()}>下载长图</Button>}
</>}>
{visualReport.loading && <p role="status">{visualReport.progress || '正在准备报告图表…'}</p>}
{progress && <p className="analysis-report-export-status" role="status" aria-live="polite">{progress}</p>}
{showVisualLoading && <p role="status">{visualReport.progress || '正在准备报告图表…'}</p>}
{progress && (!exporting || showExporting) && <p className="analysis-report-export-status" role="status" aria-live="polite">{progress}</p>}
{error && <Alert className="analysis-report-export-error" type="error" showIcon title={error} closable onClose={() => setError('')} />}
{visualReport.failed && <Alert type="warning" showIcon title="部分图表未生成,报告保留相应数据表。" />}
{visualReport.authorizationError && visualReport.authorizationError !== error && <Alert type="error" showIcon title={visualReport.authorizationError} />}