From e4f533799d08f3b7d2b7de728f0bb24f51fa8a7e Mon Sep 17 00:00:00 2001 From: lhl Date: Thu, 13 Aug 2026 11:49:58 +0800 Subject: [PATCH] chore: cleanup unused imports + design.md Phase5 notes --- docs/design.md | 4 +++- src/genesis/writer/__init__.py | 3 --- tests/test_phase5_models.py | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/design.md b/docs/design.md index 022103f..49e0a80 100644 --- a/docs/design.md +++ b/docs/design.md @@ -1729,6 +1729,8 @@ Step 3(关联推理)中部分功能推理失败: - QA 校验(确定性维度:`traceability` / `placeholder_residue` / `chapter_completeness`)。 - QA 闭环(`QALoop` 仅对失败章重新生成,受 `QALoopController(DEFAULT_MAX_QA_ROUNDS=3)` 约束)。 +> **确定性维度生效说明(Phase 5 现状)**:章节级「章节完整性(`chapter_completeness`)」维度当前因 `template_sections_expected` 恒为空而实质为空操作(恒满分),生效的确定性维度为**可追溯性(`traceability`)+ 占位符残留(`placeholder_residue`)**。待模板期望章节集合回填后,`chapter_completeness` 方才参与校验。 + **范围外(诚实标注)**: - **语义 QA 为探针**:内容准确性 / 幻觉检测 / 规则遵守等 LLM 语义维度,经 `ChapterScorer.llm_evaluators` 钩子注入,默认中性分,尚未接入真实推理(设计 §7.5 已声明待 Phase5)。 - **图表生成**:本实现不生成图形/图表,仅支持表格/列表/段落/提示框等文本型 Block(设计 §6.4 的 table/list/paragraph/note)。 @@ -1770,7 +1772,7 @@ Document(注入后 Word 文档) 3. **`RagService.retrieve_*`** 为**同步**方法(非 async)。调用方在同步编排链路中直接调用即可,无需 `await`。 4. **`map_template`** 消费真实的 `ParsedTemplate.sections`(元素类型为 `ChapterMarker`,含 `type` / `name` / `level`)。映射按文档顺序:遇到 `heading` 起一章;其后的 `section:` 占位符归属该章 → `chapter_id = id`、`section_placeholder = "section:"`。 5. **`ChapterScorer.score(chapters: list[ChapterArtifact], source: StructuredSource)`**:QA 层需要 `ChapterContent → ChapterArtifact` 适配器(由 `ChapterContent.blocks` 拼接得到 `text`,并从各 block 收集 `source_uris`);设计 §7.5 的 `ChapterArtifact` 并非直接由 Writer 产出,需经适配。 -6. **真实 `DocxInjector.Block`** 已支持 `table` / `list` / `note` 类型;表格注入会渲染 `caption` 段落(caption 非空时在其上方/下方生成说明段落),非空 caption 不应被丢弃。 +6. **真实 `DocxInjector.Block`** 支持 `paragraph` / `heading` / `table`;`list` / `note` 当前按 `paragraph` 降级渲染(原型范围,无列表/提示框样式)。表格注入会渲染 `caption` 段落(caption 非空时在其上方/下方生成说明段落),非空 caption 不应被丢弃。 ### 12.4 垂直切片状态 diff --git a/src/genesis/writer/__init__.py b/src/genesis/writer/__init__.py index be306de..a3fc57b 100644 --- a/src/genesis/writer/__init__.py +++ b/src/genesis/writer/__init__.py @@ -4,7 +4,4 @@ from __future__ import annotations from dataclasses import dataclass, field -from docx import Document -from docx.document import Document as DocxDocument - __all__ = ["Block", "DocxInjector", "DocxInjectError"] diff --git a/tests/test_phase5_models.py b/tests/test_phase5_models.py index f509659..e11d121 100644 --- a/tests/test_phase5_models.py +++ b/tests/test_phase5_models.py @@ -1,4 +1,3 @@ -from dataclasses import FrozenInstanceError from genesis.writer.models import ContentBlock, ChapterContent, GenerationContext, ChapterSpec