v0.12: stabilize search routing and profile-driven phase4 pipeline

This commit is contained in:
kai
2026-04-29 15:53:20 +08:00
parent 450ecebcff
commit 5342a26018
33 changed files with 1436 additions and 140 deletions
+33
View File
@@ -0,0 +1,33 @@
---
description: 将模型预设应用到 agent 文件。用法:/dr-apply-models <profile>
agent: dr-pm
---
你是 dr-pm。把模型预设应用到 agent 配置文件。
## 执行步骤
1. 如果 `$ARGUMENTS` 为空,先列出可用 profile
```bash
uv run python scripts/dr.py models --list
```
并提示用户至少选择 `simple / medium / premium` 之一。
2. 如果 `$ARGUMENTS` 非空,执行 dry-run
```bash
uv run python scripts/dr.py apply-models --profile "$ARGUMENTS" --target both --dry-run
```
3. 将 dry-run 结果展示给用户确认影响范围后,再执行实际应用:
```bash
uv run python scripts/dr.py apply-models --profile "$ARGUMENTS" --target both
```
4. 最后输出:
- 采用的 profile
- 更新的文件数与路径
- 下一步建议(如需同步到本机 `.codex/**`,运行 `uv run python scripts/install_codex_adapter.py --force`
+22 -39
View File
@@ -1,11 +1,11 @@
---
description: Phase 4 - 成稿(v0.6)。dr-editor-in-chief 写 ES/Abstract/Glossary,然后调 Python 脚本链路:translate → build_glossary → apply_glossary → polish → build_report。用法:/dr-finalize [slug]
description: Phase 4 - 成稿(v0.12)。dr-editor-in-chief 写 ES/Abstract/Glossary,然后调统一 Python pipelinephase4_pipeline.py。用法:/dr-finalize [slug]
agent: dr-editor-in-chief
---
你是 dr-editor-in-chief。用户执行了 `/dr-finalize $ARGUMENTS`,进入 Phase 4 成稿链路(v0.6 架构)。
你是 dr-editor-in-chief。用户执行了 `/dr-finalize $ARGUMENTS`,进入 Phase 4 成稿链路(v0.12 架构)。
## 架构变更说明(v0.6
## 架构变更说明(v0.12
**Phase 4 的翻译/润色/出稿已从 LLM agent 改为 Python 脚本**。原因:
- LLM agent 一次性处理整篇报告(19k+ 词)会超 Sonnet output token 上限(~32k),不稳定
@@ -40,57 +40,40 @@ agent: dr-editor-in-chief
- 给每章强加 SCQA 或小节标题
- 保留调度元数据(字数配额/研究员/quota 等)
## Step 3: 翻译Python 脚本)
## Step 3: 执行统一 Phase 4 pipelinePython 脚本)
```bash
uv run python scripts/translate.py <slug>
uv run python scripts/phase4_pipeline.py <slug>
```
完成条件:`phase4/final_zh.md` 生成且字数 ≥ 目标字数的 90%。如未达标,`--force` 强制重跑。
默认行为:
- 自动估算 translate / polish 并发
- glossary 仅核查低置信度术语(`--glossary-mode low-confidence`
- 统一串联 translate → glossary(optional) → apply_glossary → polish → build_report
## Step 4: 术语表核查(强烈推荐)
可选参数示例:
```bash
uv run python scripts/build_glossary.py <slug> --workers 4
uv run python scripts/phase4_pipeline.py <slug> --glossary-mode full
uv run python scripts/phase4_pipeline.py <slug> --glossary-mode off
```
完成后查看 `phase4/glossary.json`
- `confidence == "high"``issue` 非空的条目:说明发现了错误,需要回塑到正文
- 关注公司名 / 机构名 / 产品名类,它们最容易有拼写错误
完成条件:`phase4/final_zh_polished.md`、PDF、DOCX 全部生成,且无致命报错。
## Step 5: 应用术语修正(Python 脚本)
## Step 4: (可选)分步重跑
```bash
# 先预览
uv run python scripts/apply_glossary.py <slug> --input phase4/final_zh.md --dry-run
# 确认无误后应用
uv run python scripts/apply_glossary.py <slug> --input phase4/final_zh.md
```
这会把 glossary 中发现的拼写错误 / 错译直接替换进 `final_zh.md`
如润色后仍需二次复核,可手动对 `final_zh_polished.md` 再运行一次:
`uv run python scripts/apply_glossary.py <slug> --input phase4/final_zh_polished.md --dry-run`
## Step 6: 润色(Python 脚本)
```bash
uv run python scripts/polish.py <slug>
```
输出:`phase4/final_zh_polished.md`。查看 `phase4/polish_notes.jsonl` 了解模型标记的异常点。
## Step 7: 出稿(Python 脚本)
```bash
uv run python scripts/build_report.py <slug>
```
当你只想重跑单环节时,仍可手动调用:
- `translate.py`
- `build_glossary.py`
- `apply_glossary.py`
- `polish.py`
- `build_report.py`
自动:
-`manifest.report_title` 命名输出(`<Title>.pdf` + `<Title>.docx`
- PDF 自动插 TOC + 从 `phase2/sources.jsonl` 生成参考文献
## Step 8: 更新 manifest
## Step 5: 更新 manifest
```json
{
@@ -115,7 +98,7 @@ uv run python scripts/build_report.py <slug>
}
```
## Step 9: 汇报
## Step 6: 汇报
向用户展示:
- 各阶段耗时和成本
+31
View File
@@ -0,0 +1,31 @@
---
description: 查看或解析模型预设。用法:/dr-models [profile]
agent: dr-pm
---
你是 dr-pm。目标是把当前模型预设解析成清晰结果,并给出可执行命令。
## 执行步骤
1. 如果 `$ARGUMENTS` 为空:运行
```bash
uv run python scripts/dr.py models
```
2. 如果 `$ARGUMENTS` 非空:把它当作 profile,运行
```bash
uv run python scripts/dr.py models --profile "$ARGUMENTS"
```
3. 输出结果时必须包含:
- 当前 profile 名称
- 各角色模型映射(至少 dr_plan / dr_pm / dr_analyst / dr_verifier / translate / polish / glossary
- 一条可复制命令,用于 Phase 4 指定该 profile
```bash
uv run python scripts/dr.py finalize <slug> --model-profile <profile>
```
4. 如果 profile 不存在,提示可用 profile 并建议 `simple / medium / premium` 三档。