feat: enable document orientation detection for scanned PDFs

- Enable PP-StructureV3's use_doc_orientation_classify feature
- Detect rotation angle from doc_preprocessor_res.angle
- Swap page dimensions (width <-> height) for 90°/270° rotations
- Output PDF now correctly displays landscape-scanned content

Also includes:
- Archive completed openspec proposals
- Add simplify-frontend-ocr-config proposal (pending)
- Code cleanup and frontend simplification

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-11 17:13:46 +08:00
parent 57070af307
commit cfe65158a3
58 changed files with 1271 additions and 3048 deletions

View File

@@ -0,0 +1,55 @@
# Change: Remove Unused Code and Legacy Files
## Why
專案經過多次迭代開發後,累積了一些未使用的代碼和遺留文件。這些冗餘代碼增加了維護負擔、可能造成混淆,並佔用不必要的存儲空間。本提案旨在系統性地移除這些未使用的代碼,以達成專案內容及程式代碼的精簡。
## What Changes
### Backend - 移除未使用的服務文件 (3個)
| 文件 | 行數 | 移除原因 |
|------|------|----------|
| `ocr_service_original.py` | ~835 | 舊版 OCR 服務,已被 `ocr_service.py` 完全取代 |
| `preprocessor.py` | ~200 | 文檔預處理器,功能已被 `layout_preprocessing_service.py` 吸收 |
| `pdf_font_manager.py` | ~150 | 字體管理器,未被任何服務引用 |
### Frontend - 移除未使用的組件 (2個)
| 文件 | 移除原因 |
|------|----------|
| `MarkdownPreview.tsx` | 完全未被任何頁面或組件引用 |
| `ResultsTable.tsx` | 使用已棄用的 `FileResult` 類型,功能已被 `TaskHistoryPage` 替代 |
### Frontend - 遷移並移除遺留 API 服務 (2個)
| 文件 | 移除原因 |
|------|----------|
| `services/api.ts` | 舊版 API 客戶端,僅剩 2 處引用 (Layout.tsx, SettingsPage.tsx),需遷移至 apiV2 |
| `types/api.ts` | 舊版類型定義,僅 `ExportRule` 類型被使用,需遷移至 apiV2.ts |
## Impact
- **Affected specs**: 無 (純代碼清理,不改變系統行為)
- **Affected code**:
- Backend: `backend/app/services/` (刪除 3 個文件)
- Frontend: `frontend/src/components/` (刪除 2 個文件)
- Frontend: `frontend/src/services/api.ts` (遷移後刪除)
- Frontend: `frontend/src/types/api.ts` (遷移後刪除)
## Benefits
- 減少約 1,200+ 行後端冗餘代碼
- 減少約 300+ 行前端冗餘代碼
- 提高代碼維護性和可讀性
- 消除新開發者的混淆源
- 統一 API 客戶端到 apiV2
## Risk Assessment
- **風險等級**: 低
- **回滾策略**: Git revert 即可恢復所有刪除的文件
- **測試要求**:
- 確認後端服務啟動正常
- 確認前端所有頁面功能正常
- 特別測試 SettingsPage (ExportRule) 功能