格式化压缩摘要 — 源码 compact.rs:38-50 处理 XML 标签: 1. 删除 ... 块(这是给内部用的分析) 2. 把 ... 替换成 "Summary:\n" 前缀
(summary: str)
| 657 | |
| 658 | |
| 659 | def format_compact_summary(summary: str) -> str: |
| 660 | """格式化压缩摘要 — 源码 compact.rs:38-50 |
| 661 | |
| 662 | 处理 XML 标签: |
| 663 | 1. 删除 <analysis>...</analysis> 块(这是给内部用的分析) |
| 664 | 2. 把 <summary>...</summary> 替换成 "Summary:\n" 前缀 |
| 665 | """ |
| 666 | # 删除 <analysis> 块 |
| 667 | result = re.sub(r'<analysis>.*?</analysis>', '', summary, flags=re.DOTALL) |
| 668 | # 替换 <summary> 标签 |
| 669 | match = re.search(r'<summary>(.*?)</summary>', result, flags=re.DOTALL) |
| 670 | if match: |
| 671 | content = match.group(1).strip() |
| 672 | result = result.replace(match.group(0), f"Summary:\n{content}") |
| 673 | return _collapse_blank_lines(result).strip() |
| 674 | |
| 675 | |
| 676 | def get_compact_continuation_message( |
no test coverage detected