一站式:text → (含锚点文本, outline 字典) 幂等:text 已含锚点时仅重建 outline,不重复加锚。 若提供 previous_outline,新 outline 会保留同 anchor 的 agent_summary。
(text: str, doc_path: str, previous_outline: dict | None = None)
| 279 | |
| 280 | |
| 281 | def process(text: str, doc_path: str, previous_outline: dict | None = None) -> tuple[str, dict]: |
| 282 | """ |
| 283 | 一站式:text → (含锚点文本, outline 字典) |
| 284 | 幂等:text 已含锚点时仅重建 outline,不重复加锚。 |
| 285 | 若提供 previous_outline,新 outline 会保留同 anchor 的 agent_summary。 |
| 286 | """ |
| 287 | text_with_anchors, _blocks = add_anchors(text) |
| 288 | outline_data = build_outline_data( |
| 289 | text_with_anchors, doc_path, previous_outline=previous_outline |
| 290 | ) |
| 291 | return text_with_anchors, outline_data |