Files
OCR/openspec/changes/archive/2025-12-12-add-batch-processing/proposal.md
egg d20751d56b feat: add batch processing for multiple file uploads
- Add BatchState management in taskStore with progress tracking
- Implement batch processing service with concurrency control
  - Direct Track: max 5 parallel tasks
  - OCR Track: sequential processing (GPU VRAM limit)
- Refactor ProcessingPage to support batch mode with BatchProcessingPanel
- Update UploadPage to initialize batch state for multi-file uploads
- Add i18n translations for batch processing (zh-TW, en-US)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-12 17:05:16 +08:00

44 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Change: 新增批次處理功能
## Why
目前系統支援批次上傳多個檔案,但處理時需要使用者逐一點選每個任務進行處理。這對於大量文件的處理場景非常不便。需要新增批次處理功能,讓使用者可以一次設定並啟動所有上傳的任務。
## What Changes
### 1. 批次狀態管理
- 擴展 taskStore 支援批次任務追蹤
- 新增批次進度狀態(總數、已完成、處理中、失敗)
- 儲存批次統一設定
### 2. 批次處理邏輯
- 上傳完成後分析所有檔案決定處理軌道
- 根據軌道類型分流處理:
- Direct Track最多 5 個並行CPU 運算)
- OCR Track單一佇列GPU VRAM 限制)
- 兩類任務可同時進行
### 3. 批次設定 UI
- 修改 ProcessingPage 支援多任務模式
- 統一設定介面:
- 處理策略(自動判斷/強制 OCR/強制 Direct
- Layout ModelOCR 專用)
- 預處理模式OCR 專用)
- 批次進度顯示(整體進度 + 各任務狀態)
### 4. 處理策略
- **自動判斷**(推薦):系統分析每個檔案後自動選擇最佳 track
- **全部 OCR**:強制所有檔案使用 OCR track
- **全部 Direct**:強制所有 PDF 使用 Direct track
## Impact
- Affected specs: frontend-ui (修改)
- Affected code:
- `frontend/src/store/taskStore.ts` - 擴展批次狀態
- `frontend/src/pages/ProcessingPage.tsx` - 支援多任務處理
- `frontend/src/pages/UploadPage.tsx` - 傳遞多任務 ID
- `frontend/src/services/apiV2.ts` - 新增批次處理輔助函數
- `frontend/src/i18n/locales/*.json` - 新增翻譯
- 後端無需改動(利用現有 API