MicroFish/backend/app/api
andreicarpen 0387dc7210 feat(report): allow resuming report generation after failure
When report generation in Step 4 fails mid-way (e.g. AI credits exhausted,
network error), users previously had to restart from scratch, losing the
outline and any already-completed sections.

This change preserves partial progress and lets users continue from where
generation stopped:

- Backend: `generate_report(resume=True)` reloads the saved outline and
  per-section markdown files, skips the planning phase, and only generates
  the missing sections. The `/api/report/generate` endpoint accepts a
  `resume` flag and reuses the failed report's `report_id`.
- Frontend: Step4Report polls `/progress` and, when `status === 'failed'`,
  shows a "Resume Generation" banner with the failure message and a button
  that calls `generateReport({ simulation_id, resume: true })` and
  restarts log polling.
- Adds `resumeStart` / `sectionResumed` / `reportFailedTitle` /
  `resumeGeneration` locale keys in en and zh.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 16:48:58 +03:00
..
__init__.py Implement Report Agent for automated report generation and interaction 2025-12-09 15:10:55 +08:00
graph.py fix(i18n): pass locale to background threads via thread-local storage 2026-04-01 16:55:51 +08:00
report.py feat(report): allow resuming report generation after failure 2026-04-18 16:48:58 +03:00
simulation.py fix(i18n): replace hardcoded Chinese stage names in simulation prepare SSE 2026-04-01 17:31:00 +08:00