Files
OCR/openspec/changes/archive/2025-11-17-fix-v2-api-ui-issues/proposal.md
egg 012da1abc4 fix: migrate UI to V2 API and fix admin dashboard
Backend fixes:
- Fix markdown generation using correct 'markdown_content' key in tasks.py
- Update admin service to return flat data structure matching frontend types
- Add task_count and failed_tasks fields to user statistics
- Fix top users endpoint to return complete user data

Frontend fixes:
- Migrate ResultsPage from V1 batch API to V2 task API with polling
- Create TaskDetailPage component with markdown preview and download buttons
- Refactor ExportPage to support multi-task selection using V2 download endpoints
- Fix login infinite refresh loop with concurrency control flags
- Create missing Checkbox UI component

New features:
- Add /tasks/:taskId route for task detail view
- Implement multi-task batch export functionality
- Add real-time task status polling (2s interval)

OpenSpec:
- Archive completed proposal 2025-11-17-fix-v2-api-ui-issues
- Create result-export and task-management specifications

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 08:55:50 +08:00

1.5 KiB

Change: Fix V2 API UI Integration Issues

Why

After migrating from V1 batch-based architecture to V2 task-based architecture, several UI pages still reference V1 APIs or have incomplete implementations:

  1. Results page (http://127.0.0.1:5173/results) doesn't display task details - uses non-existent V1 getBatchStatus API
  2. Task History page markdown downloads produce empty files (0 bytes) - OCR service not generating markdown content
  3. Task History page "View Details" button navigates to /tasks/{taskId} route that doesn't exist
  4. Export page (http://127.0.0.1:5173/export) uses non-existent V1 /api/v2/export endpoint (404) and lacks multi-task selection
  5. Admin Dashboard page loads but may have permission or API issues

These issues were discovered during testing with task ID: 88c6c2d2-37e1-48fd-a50f-406142987bdf using file Henkel-84-1LMISR4 (漢高).pdf.

What Changes

  • Migrate ResultsPage from V1 batch API to V2 task API
  • Fix OCR service markdown generation to produce non-empty .md files
  • Add task detail page route and component at /tasks/:taskId
  • Update ExportPage to use V2 download endpoints and support multi-task selection
  • Verify and fix Admin Dashboard API integration and permissions

Impact

  • Affected specs: task-management, result-export
  • Affected code:
    • Frontend: src/pages/ResultsPage.tsx, src/pages/ExportPage.tsx, src/App.tsx (routes), new src/pages/TaskDetailPage.tsx
    • Backend: app/services/ocr_service.py (markdown generation), app/routers/tasks.py (download endpoints)