feat(roundtable): Step2 提速四件套 + 方案总结报告意图对齐

Step2 提速:
- 每席位推理深度覆盖(seat_mode): 业务链条逐席位可配 flash/thinking/pro/ultra,
  覆盖链条级 seatMode;前台三处 dispatch + 后台 job 透传, run_seat 用 _SEAT_MODE_PARAMS 解析
- recommend 后端批内并行: engine._run_recommend 由串行 for 改 asyncio.gather(对齐前端)
- 研讨前并行取数两段式(gather_first, 业务链条 opt-in): 研讨前全席位并行只取数,
  产出作为共享资料注入研讨轮(_seat_message gathered + 前台 runGatherPhase);
  新增 gather_first 列(migration 20260620_02 + idempotent SQL)
- 削减重复广播: suppressPreBroadcast 扩到 recommend(round>=2)/chain(i>0)/chain收口,
  保留首轮背景打底,省 N 次读写大 thread

方案总结报告效果:
- summary 加"意图对齐+缺口核对+防幻觉护栏": SOUL + 后端 build_summary_prompt +
  前端 buildSummaryPrompt 三处对齐; 推断标注(综合推断)、缺真实信息标注待补充交给用户、绝不凭空编

Tests: test_roundtable_seat_modes / test_roundtable_gather_phase / test_roundtable_summary_prompt

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
董宏凯andClaude Opus 4.8 committed 2026-06-20 16:28:02 +08:00
1 parent 9a1b674950
commit 3ab674e438
25 files changed
+985 -44

No files matched your search

@@ -0,0 +1,50 @@
"""方案总结报告 prompt(build_summary_prompt)的意图对齐 + 缺口护栏内容测试。
效果改造 B:弱席位场景下,总结智能体不能只拼接各席位交付,而要先对齐用户意图、核对覆盖、
按护栏补强(推断标注「(综合推断)」、缺真实信息标注「待补充」交给用户、绝不凭空编)。
prompt 是纯函数,直接断言其文本包含这些指令 + 仍带齐意图/交付/共识/编排提示原料。
"""
from __future__ import annotations
from deerflow.agents.roundtable_orchestrator.engine import build_summary_prompt
from deerflow.agents.roundtable_orchestrator.types import SeatRef
_AGENTS = [SeatRef("seat-a", "情报"), SeatRef("seat-b", "方案")]
_DELIVERIES = {"seat-a": "情报席位交付内容", "seat-b": "方案席位交付内容"}
def test_summary_prompt_carries_intent_and_alignment_directive():
out = build_summary_prompt(
"目标:拿下华东市场\n约束条件:\n- 预算有限",
_AGENTS,
_DELIVERIES,
"总控共识:分两期推进",
coordinator_prompt="重点突出风险",
)
# 原料齐全
assert "拿下华东市场" in out
assert "预算有限" in out
assert "情报席位交付内容" in out and "方案席位交付内容" in out
assert "总控共识:分两期推进" in out
assert "重点突出风险" in out # 编排提示
# 意图对齐 + 缺口核对指令
assert "意图对齐与缺口核对" in out
assert "核心诉求清单" in out
# 防幻觉护栏三条
assert "综合推断" in out
assert "待补充" in out
assert "绝不凭空编" in out
def test_summary_prompt_alignment_directive_present_even_without_coordinator_prompt():
out = build_summary_prompt("目标:X", _AGENTS, _DELIVERIES, "共识 Y")
assert "意图对齐与缺口核对" in out
assert "待补充" in out
def test_summary_prompt_handles_empty_deliveries_gracefully():
out = build_summary_prompt("目标:X", _AGENTS, {}, "")
# 无交付时仍给出兜底说明,且意图对齐指令照常在
assert "暂无文字交付" in out
assert "意图对齐与缺口核对" in out