v0.21 alpha add research brief and compressed findings

This commit is contained in:
kai
2026-05-06 19:23:30 +08:00
parent db626f1d58
commit 0644a68ecc
13 changed files with 539 additions and 27 deletions
+14
View File
@@ -11,10 +11,12 @@ if str(REPO_ROOT) not in sys.path:
from scripts.runtime.assembly import (
ChapterAssemblyWorker,
build_chapter_briefs,
build_compressed_findings,
build_chapter_user_prompt,
run_chapter_assembly_workers,
validate_chapter_markdown_citations,
validate_chapter_brief,
validate_compressed_finding,
)
from scripts.runtime.roles import resolve_runtime_profile
@@ -104,6 +106,17 @@ def test_build_chapter_briefs_aggregates_packets_by_chapter(tmp_path: Path) -> N
assert "src_002" in brief["source_ids"]
assert (project / "phase2/chapter_briefs/ch01.json").exists()
compressed = build_compressed_findings(project)
assert len(compressed) == 1
finding = compressed[0]
validate_compressed_finding(finding)
assert finding["chapter_id"] == "ch01"
assert "chapter_thesis" in finding
assert "evidence_landings" in finding
assert "src_001" in finding["source_ids"]
assert (project / "phase2/compressed_findings/ch01.json").exists()
def test_chapter_prompt_contains_brief_and_fragmentation_guard() -> None:
brief = {
@@ -122,6 +135,7 @@ def test_chapter_prompt_contains_brief_and_fragmentation_guard() -> None:
assert "临床证据正在重塑需求判断" in prompt
assert "避免碎片化" in prompt
assert "compressed finding" in prompt
assert "只输出 Markdown" in prompt