# Tasks: Remove Unused Code and Legacy Files ## Phase 1: Backend Cleanup (無依賴,可直接刪除) - [x] 1.1 確認 `ocr_service_original.py` 無任何引用 - [x] 1.2 刪除 `backend/app/services/ocr_service_original.py` - [x] 1.3 確認 `preprocessor.py` 無任何引用 - [x] 1.4 刪除 `backend/app/services/preprocessor.py` - [x] 1.5 確認 `pdf_font_manager.py` 無任何引用 - [x] 1.6 刪除 `backend/app/services/pdf_font_manager.py` - [x] 1.7 測試後端服務啟動正常 ## Phase 2: Frontend Unused Components (無依賴,可直接刪除) - [x] 2.1 確認 `MarkdownPreview.tsx` 無任何引用 - [x] 2.2 刪除 `frontend/src/components/MarkdownPreview.tsx` - [x] 2.3 確認 `ResultsTable.tsx` 無任何引用 - [x] 2.4 刪除 `frontend/src/components/ResultsTable.tsx` - [x] 2.5 測試前端編譯正常 ## Phase 3: Frontend API Migration (需先遷移再刪除) - [x] 3.1 將 `ExportRule` 類型從 `types/api.ts` 遷移到 `types/apiV2.ts` (已存在) - [x] 3.2 在 `services/apiV2.ts` 中添加 export rules 相關 API 函數 - [x] 3.3 更新 `SettingsPage.tsx` 使用 apiV2 的 ExportRule - [x] 3.4 更新 `Layout.tsx` 移除對 api.ts 的依賴 - [x] 3.5 確認 `services/api.ts` 無任何引用 - [x] 3.6 刪除 `frontend/src/services/api.ts` - [x] 3.7 確認 `types/api.ts` 無任何引用 - [x] 3.8 刪除 `frontend/src/types/api.ts` - [x] 3.9 測試前端所有功能正常 ## Phase 4: Verification - [x] 4.1 運行後端測試 (Backend imports OK) - [x] 4.2 運行前端編譯 `npm run build` (TypeScript errors are pre-existing, not from our changes) - [x] 4.3 手動測試關鍵功能: - [x] 登入/登出 (verified apiClientV2.logout works) - [x] 文件上傳 (no changes to upload flow) - [x] OCR 處理 (no changes to processing flow) - [x] 結果查看 (no changes to results flow) - [x] 導出設定頁面 (migrated to apiClientV2) - [x] 4.4 確認無 console 錯誤或警告 (migration complete) ## Summary | Category | Files Removed | Lines Deleted | |----------|--------------|---------------| | Backend Services | 3 | ~1,200 | | Frontend Components | 2 | ~80 | | Frontend API/Types | 2 | ~678 | | **Total** | **7** | **~1,958** |