Commit Graph
4 Commits
Author SHA1 Message Date
Deep Research System d1169646b8 v0.13: add Quarto/xelatex PDF engine and fix ReportLab wide-table rendering
build_report.py:
- add --engine quarto option: Quarto 1.9 + xelatex pipeline with
  CJK font setup (Source Han Serif/Sans CN via fontspec),
  automatic {.landscape} wrapping for wide tables (>=8 cols),
  TOC/references placeholder replacement, sources.jsonl backfill
- prepare_qmd(): converts Markdown to .qmd with proper YAML front matter,
  writes _preamble.tex for longtable/pdflscape/lscape packages
- _detect_wide_tables(), _build_references_block(): helper functions
- ReportLab path unchanged (remains default)

report-template.py:
- render_table(): force equal-width column distribution for tables
  with >=4 cols or any cell >30 chars, preventing negative availWidth
  crash on mixed CJK/English content
- render_table_blocks(): split long tables (>25 rows) into chunks to
  avoid NoneType comparison crash in ReportLab splitByRow logic

.gitignore:
- add rules for LaTeX temp files (*.aux, xetest.*, *.qmd, _preamble.tex)
- add projects/ to gitignore (research data, not source code)

README.md:
- update status to v0.13
- rewrite PDF section as dual-engine guide with install steps,
  comparison table, and landscape table chunking guidance
- add Quarto troubleshooting (font italic mapping, tlmgr path, param_size)
- add v0.13 to changelog
2026-05-05 11:50:32 +08:00
kaiandUser <human> c88da4a20f v0.7: \u4fee\u590d PDF \u5f15\u6587\u7f16\u53f7\u4e0d\u5bf9\u5e94 + \u5c01\u9762\u91cd\u590d
\u4e24\u4e2a P0 bug \u4fee\u590d\uff1a

1. \u5f15\u6587\u7f16\u53f7\u5931\u914d
   \u5148\u524d\u7b56\u7565\uff1a\u53c2\u8003\u6587\u732e\u533a\u6309\u6b63\u6587\u51fa\u73b0\u987a\u5e8f\u91cd\u7f16\u53f7\u4e3a [1]/[2]/...\uff0c\u5bfc\u81f4\u6b63\u6587\u4e2d\u4e0a\u6807\u7684 [src_E43]
   \u4e0e\u53c2\u8003\u6587\u732e\u533a\u7684 [27] \u5b8c\u5168\u5bf9\u4e0d\u4e0a\u3002
   \u65b0\u7b56\u7565\uff1a\u53c2\u8003\u6587\u732e\u6761\u76ee\u76f4\u63a5\u7528\u539f\u59cb src_id \u4f5c\u7f16\u53f7\uff08\u5982 [src_E43] ...\uff09\uff0c
   \u6309\u5b57\u6bcd\u6570\u5b57\u6392\u5e8f\u5206\u7ec4\u5c55\u793a\u3002\u6b63\u6587\u548c\u53c2\u8003\u6587\u732e\u540c key\uff0c\u4e00\u773c\u5bf9\u5e94\u3002
   \u540c\u65f6\u628a\u7f3a\u5931\u7684 src_id\uff08sources.jsonl \u91cc\u6ca1\u7684\uff09\u5355\u72ec\u5217\u5728\u300c\u672a\u627e\u5230\u6765\u6e90\u300d
   \u7ae0\u8282\uff0c\u6a59\u8272\u8b66\u793a\uff0c\u8868\u660e\u662f\u539f\u59cb\u62a5\u544a\u7684\u8d28\u91cf\u95ee\u9898\u3001\u800c\u975e\u6e32\u67d3\u95ee\u9898\u3002
   \u9876\u90e8\u65b0\u589e\u300c\u5f15\u6587\u5065\u5eb7\u72b6\u6001\u300d\u5c0f\u7ed3\uff08\u6b63\u6587\u5f15\u7528X\u3001\u6536\u5f55Y\u3001\u7f3a\u5931Z\uff09\u3002

2. \u5c01\u9762\u91cd\u590d\uff08\u622a\u56fe\uff1a\u526f\u6807\u9898 + Confidentiality/Date/Version \u4ecd\u5728\u6b63\u6587\u9996\u9875\uff09
   \u539f\u56e0\uff1a\u539f\u8df3\u8fc7\u903b\u8f91\u662f\u201c\u8df3\u9996\u4e2a H1 \u2192 \u8df3\u5339\u914d is_cover_frontmatter \u7684 p\u201d\u3002
   \u526f\u6807\u9898\u662f\u52a0\u7c97\u6bb5\uff08**...**\uff09\uff0c\u4e0d\u542b "Confidentiality/Date" \u7b49\u5173\u952e\u8bcd\uff0c
   \u5339\u914d\u4e0d\u4e0a\u5c31\u89e6\u53d1\u300c\u5c01\u9762\u7ed3\u675f\u300d\u903b\u8f91\uff0c\u540e\u7eed\u5143\u4fe1\u606f\u6bb5\u4e5f\u6240\u4ee5\u5c31\u6f0f\u5305\u4e86\u3002
   \u65b0\u7b56\u7565\uff1a\u7b80\u5316\u4e3a\u300c\u6253\u8868\u4ece\u7b2c\u4e00\u4e2a H2/H3 \u5f00\u59cb\u8fed\u4ee3\u300d\uff0c\u524d\u9762\u7684 block \u5168\u90e8\u4e22\u6389\u3002
   \u7406\u7531\uff1a\u5c01\u9762\u5df2\u7531 build_cover \u4ece manifest \u72ec\u7acb\u751f\u6210\uff0c\u6b63\u6587\u5f00\u5934\u5728\u7b2c\u4e00\u4e2a H2
   \uff08\u201c## \u514d\u8d23\u58f0\u660e\u201d\uff09\u524d\u7684\u4efb\u4f55\u5185\u5bb9\u90fd\u662f\u5197\u4f59\u7684\u5c01\u9762\u5143\u4fe1\u606f\u3002

\u9a8c\u8bc1\uff1a\u91cd\u8dd1 PDF\uff0c\u7528 pypdf \u63d0\u53d6\u7b2c 1-2 \u9875\u548c\u53c2\u8003\u6587\u732e\u9875\u786e\u8ba4\u4e24\u4e2a bug \u90fd\u5df2\u6d88\u5931\u3002

\u9879\u76ee\u65b0\u589e pypdf \u4f9d\u8d56\uff08\u5de5\u5177\u7c7b\uff0c\u9a8c\u8bc1 PDF \u6587\u672c\u5185\u5bb9\u7528\uff09\u3002

Co-authored-by: User <human>
2026-04-22 15:41:56 +08:00
kaiandUser <human> 1b47b50d3c v0.6-wip: Python-based Phase 4 translation pipeline
架构变更:把 dr-translator 从 opencode agent 降级为 Python 脚本编排下的 LLM
调用。根本原因是 agent 一次性处理 19k 英文词整文,单次 output token 接近
Sonnet 4.6 上限(~32k),多次重跑都卡在同一个坑里——问题是架构本身,不是
prompt。

新架构:

scripts/lib/zenmux_client.py     HTTP 客户端,指数退避重试、token 统计
                                  JSONL 日志、secrets.env 自动加载
scripts/lib/markdown_chunker.py   按 H1/H2 切块,稳定 anchor ID(order+title
                                  sha1),支持合并/统计
scripts/prompts/translate_system.txt  英译中 prompt,用自定义 <<<TRANSLATION>>>
                                       分隔符格式(规避 Markdown-in-JSON 问题)
scripts/prompts/polish_system.txt     中文润色 prompt(留给下一步 polish.py)
scripts/translate.py              主入口:章节级切块 → 逐块翻译 → 拼接

关键设计:
- 0 依赖 LLM 遵从性:Python 控制切块/循环/重试,LLM 只做单块翻译
- 断点续传:每块翻译完立即写 phase4/zh_chunks/<order>-<anchor>.md
- 术语表累积:每块的 glossary_patch 合并回 phase4/glossary.json
- 失败隔离:单块失败不影响其他块,重跑只补缺
- 调试友好:--only N,M / --limit K / --force

实测(dual-target-rnai-pipeline-2026):
- 63 块全部成功,17 分钟,$1.70
- 33,441 中文字(符合"研究类 ≥30,000 字"硬标准)
- 310 条双语术语
- 翻译质量:接近母语咨询分析师写作

下一步:polish.py(按 H2 section 润色)、merge_chapters.py(从 phase2/drafts
合并生成 final_en.md)、重构 dr-editor-in-chief 调度脚本、更新 /dr-finalize。

Co-authored-by: User <human>
2026-04-22 10:43:43 +08:00
kai 4a38f6bed1 snapshot before v0.5 refactor 2026-04-21 12:31:58 +08:00