feat: add translated PDF format selection (layout/reflow)

- Add generate_translated_layout_pdf() method for layout-preserving translated PDFs
- Add generate_translated_pdf() method for reflow translated PDFs
- Update translate router to accept format parameter (layout/reflow)
- Update frontend with dropdown to select translated PDF format
- Fix reflow PDF table cell extraction from content dict
- Add embedded images handling in reflow PDF tables
- Archive improve-translated-text-fitting openspec proposal

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-03 10:10:28 +08:00
parent 0dcea4a7e7
commit 08adf3d01d
15 changed files with 1384 additions and 1222 deletions

View File

@@ -10,6 +10,7 @@
- **OCR 解析**PaddleOCR + `PPStructureEnhanced` 抽取 23 類元素;`OCRToUnifiedConverter` 轉成 `UnifiedDocument` 統一格式。
- **匯出/呈現**`UnifiedDocumentExporter` 產出 JSON/Markdown`pdf_generator_service.py` 產生版面保持 PDF前端透過 `/api/v2/tasks/{id}/download/*` 取得。
- **資源控管**`memory_manager.py`MemoryGuard、prediction semaphore、模型生命週期`service_pool.py``OCRService` 池)避免多重載模與 GPU 爆滿。
- **翻譯與預覽**`translation_service` 針對已完成任務提供異步翻譯(`/api/v2/translate/*``layout_preprocessing_service` 提供預處理預覽與品質指標(`/preview/preprocessing``/preview/image`)。
## 處理流程(任務層級)
1. **上傳**`POST /api/v2/upload` 建立 Task 並寫檔到 `uploads/`(含 SHA256、檔案資訊