feat: optimize task file generation and add visualization download
Backend changes: - Disable PP-Structure debug file generation by default - Separate raw_ocr_regions.json generation from debug flag (critical file) - Add visualization folder download endpoint as ZIP - Add has_visualization field to TaskDetailResponse - Stop generating Markdown files - Save translated PDFs to task folder with caching Frontend changes: - Replace JSON/MD download buttons with PDF buttons in TaskHistoryPage - Add visualization download button in TaskDetailPage - Fix Processing page task switching issue (reset isNotFound) Archives two OpenSpec proposals: - optimize-task-files-and-visualization - simplify-frontend-add-billing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -300,6 +300,24 @@ export default function TaskDetailPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleDownloadVisualization = async () => {
|
||||
if (!taskId) return
|
||||
try {
|
||||
await apiClientV2.downloadVisualization(taskId)
|
||||
toast({
|
||||
title: '下載成功',
|
||||
description: '辨識結果圖片已下載',
|
||||
variant: 'success',
|
||||
})
|
||||
} catch (error: any) {
|
||||
toast({
|
||||
title: '下載失敗',
|
||||
description: error.response?.data?.detail || t('errors.networkError'),
|
||||
variant: 'destructive',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const getStatusBadge = (status: string) => {
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
@@ -477,6 +495,19 @@ export default function TaskDetailPage() {
|
||||
<span>流式 PDF</span>
|
||||
</Button>
|
||||
</div>
|
||||
{/* Visualization download for OCR Track */}
|
||||
{taskDetail?.has_visualization && (
|
||||
<div className="mt-3 pt-3 border-t">
|
||||
<Button
|
||||
onClick={handleDownloadVisualization}
|
||||
variant="secondary"
|
||||
className="w-full gap-2"
|
||||
>
|
||||
<Image className="w-4 h-4" />
|
||||
下載辨識結果圖片 (ZIP)
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user