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:
egg
2025-12-12 19:11:50 +08:00
parent 65abd51d60
commit efa7e4175c
14 changed files with 534 additions and 97 deletions

View File

@@ -255,14 +255,8 @@ class UnifiedDocumentExporter:
logger.error(f"Failed to export JSON: {e}")
results['json'] = None
# Export Markdown
try:
md_path = output_dir / f"{file_id}_output.md"
UnifiedDocumentExporter.export_to_markdown(document, md_path)
results['markdown'] = md_path
except Exception as e:
logger.error(f"Failed to export Markdown: {e}")
results['markdown'] = None
# Markdown export removed - no longer generating _output.md files
results['markdown'] = None
# Export plain text
try:
@@ -469,13 +463,13 @@ def save_unified_document(
document: The UnifiedDocument to save
output_dir: Output directory
file_id: Base filename
formats: List of formats to export (default: ['json', 'markdown'])
formats: List of formats to export (default: ['json'])
Returns:
Dictionary mapping format names to output paths
"""
if formats is None:
formats = ['json', 'markdown']
formats = ['json']
results = {}
output_dir = Path(output_dir)
@@ -488,9 +482,9 @@ def save_unified_document(
UnifiedDocumentExporter.export_to_json(document, path)
results['json'] = path
elif fmt == 'markdown':
path = output_dir / f"{file_id}_output.md"
UnifiedDocumentExporter.export_to_markdown(document, path)
results['markdown'] = path
# Markdown export removed - skip silently
results['markdown'] = None
continue
elif fmt == 'text':
path = output_dir / f"{file_id}_text.txt"
UnifiedDocumentExporter.export_to_text(document, path)