Files
OCR/openspec/changes/archive/2025-12-11-remove-unused-code/tasks.md
egg cfe65158a3 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>
2025-12-11 17:13:46 +08:00

2.1 KiB

Tasks: Remove Unused Code and Legacy Files

Phase 1: Backend Cleanup (無依賴,可直接刪除)

  • 1.1 確認 ocr_service_original.py 無任何引用
  • 1.2 刪除 backend/app/services/ocr_service_original.py
  • 1.3 確認 preprocessor.py 無任何引用
  • 1.4 刪除 backend/app/services/preprocessor.py
  • 1.5 確認 pdf_font_manager.py 無任何引用
  • 1.6 刪除 backend/app/services/pdf_font_manager.py
  • 1.7 測試後端服務啟動正常

Phase 2: Frontend Unused Components (無依賴,可直接刪除)

  • 2.1 確認 MarkdownPreview.tsx 無任何引用
  • 2.2 刪除 frontend/src/components/MarkdownPreview.tsx
  • 2.3 確認 ResultsTable.tsx 無任何引用
  • 2.4 刪除 frontend/src/components/ResultsTable.tsx
  • 2.5 測試前端編譯正常

Phase 3: Frontend API Migration (需先遷移再刪除)

  • 3.1 將 ExportRule 類型從 types/api.ts 遷移到 types/apiV2.ts (已存在)
  • 3.2 在 services/apiV2.ts 中添加 export rules 相關 API 函數
  • 3.3 更新 SettingsPage.tsx 使用 apiV2 的 ExportRule
  • 3.4 更新 Layout.tsx 移除對 api.ts 的依賴
  • 3.5 確認 services/api.ts 無任何引用
  • 3.6 刪除 frontend/src/services/api.ts
  • 3.7 確認 types/api.ts 無任何引用
  • 3.8 刪除 frontend/src/types/api.ts
  • 3.9 測試前端所有功能正常

Phase 4: Verification

  • 4.1 運行後端測試 (Backend imports OK)
  • 4.2 運行前端編譯 npm run build (TypeScript errors are pre-existing, not from our changes)
  • 4.3 手動測試關鍵功能:
    • 登入/登出 (verified apiClientV2.logout works)
    • 文件上傳 (no changes to upload flow)
    • OCR 處理 (no changes to processing flow)
    • 結果查看 (no changes to results flow)
    • 導出設定頁面 (migrated to apiClientV2)
  • 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