统一:DSH 智能分析、Top100 与图表静默恢复

接入 DSH 专用运行时和对话界面,保留模型原始回答,支持会话分页、连续追问与显式报告。
补齐组合筛选、各维度 Top100、分组查询到排名图的转换,图表故障静默省略并基于保存数据自动恢复。
优化报告风格、图表顺序和表格换行,更新接入说明及构建输入。

验证:独立目录前后端构建通过;118 项 Java、102 项前端、102 项图表、14 项 DSH 应用和 13 项组合筛选检查通过。
仅提交相关源码、锁定依赖与测试;不包含凭据、会话、业务数据或本地产物。
This commit is contained in:
2026-11-12 11:57:41 +08:00
parent cc8832c8e5
commit f1a2fbd494
166 changed files with 26281 additions and 2248 deletions
+16 -5
View File
@@ -1432,11 +1432,22 @@ def _execute_query_plan(*, request, task, authority, actor_root, delegated, conn
synthesis_context['_protocolScopes'] = {'scopes':metric_scopes,'pending':pending_latest,'gaps':[]}
has_synthesis_nodes = any(node.get('purpose') in ('ranking','metrics','trend','defects','changes')
for node in task.get('queryPlan',[]))
has_source_nodes = any(scope.get('purpose') == 'source' for scope in raw_scopes)
source_only_autonomous_finalization = bool(request.get('_autonomousAnswer') is True
and not has_synthesis_nodes and has_source_nodes)
source_synthesis_evidence = ([document for document in evidence
if isinstance(document.get('result'), dict)
and document.get('mode') == 'investigate'
and document['result'].get('kind') == 'quality_investigation'
and document['result'].get('action') == 'source']
if request.get('_autonomousAnswer') is True
and (has_synthesis_nodes or source_only_autonomous_finalization) else [])
synthesis_evidence = [*metric_evidence, *source_synthesis_evidence]
raw_report = _raw_node_report(raw_diagnostics, raw_scopes, [])
protocol_raw_coverage = _protocol_raw_coverage(task, raw_report)
if protocol_raw_coverage is not None:
synthesis_context['_protocolRawCoverage'] = protocol_raw_coverage
if raw_scopes and not has_synthesis_nodes:
if raw_scopes and not has_synthesis_nodes and not source_only_autonomous_finalization:
answer_lines = ['已按本轮服务器授权范围核对原始数据。']
answer_lines.extend(fact.get('text','')+' ['+fact.get('evidenceRef','')+']'
for fact in raw_report.get('facts',[]) if fact.get('text'))
@@ -1451,7 +1462,7 @@ def _execute_query_plan(*, request, task, authority, actor_root, delegated, conn
'finishReason':'raw_scope_evidence'}
else:
final = synthesize(base_url=base, api_key=key, model=model, question=request['question'],
evidence=metric_evidence, cancel_event=cancel_event, context=synthesis_context)
evidence=synthesis_evidence, cancel_event=cancel_event, context=synthesis_context)
_save_composition(final, actor_root, request['turnId'])
empty_scope_gaps = {}
for diagnostic in query_diagnostics:
@@ -1528,13 +1539,13 @@ def _execute_query_plan(*, request, task, authority, actor_root, delegated, conn
covered = bool(metric_covered and raw_covered and not server_gaps)
raw_answer_facts = [fact for fact in raw_report.get('facts',[])
if isinstance(fact,dict) and isinstance(fact.get('text'),str)]
if has_synthesis_nodes and raw_answer_facts:
if (has_synthesis_nodes or source_only_autonomous_finalization) and raw_answer_facts:
final['answer'] = str(final.get('answer') or '')+'\n\n原始数据读取:\n'+'\n'.join(
'- '+fact['text']+' ['+str(fact.get('evidenceRef') or '')+']' for fact in raw_answer_facts)
if has_synthesis_nodes and raw_report.get('missingEvidence'):
if (has_synthesis_nodes or source_only_autonomous_finalization) and raw_report.get('missingEvidence'):
final['answer'] = (str(final.get('answer') or '')+'\n\n原始读取未覆盖:'
+';'.join(raw_report['missingEvidence']))
if has_synthesis_nodes and server_gaps:
if (has_synthesis_nodes or source_only_autonomous_finalization) and server_gaps:
final['answer'] = (str(final.get('answer') or '')+'\n\n未完成范围:'
+';'.join(server_gaps))
complete = bool(covered and final.get('evidenceSufficient') and not server_gaps and not missing_visuals