video_translate/docs/plans/2026-03-19-subtitle-jobs-async.md
Song367 04072dc94b
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m6s
commit code
2026-03-19 20:13:24 +08:00

2.1 KiB

Subtitle Jobs Async Implementation Plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: Convert subtitle generation to an async job flow with 5-second polling and a staged progress bar.

Architecture: Add a backend in-memory subtitle job store, make /api/generate-subtitles return 202 immediately, expose a job lookup endpoint, and teach the frontend subtitle service and editor UI to poll and render stage-based progress.

Tech Stack: Express, TypeScript, React, Vitest


Task 1: Add backend job store helpers

Files:

  • Create: E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleJobs.ts
  • Test: E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleJobs.test.ts

Task 2: Convert subtitle route to async job submission

Files:

  • Modify: E:\Downloads\ai-video-dubbing-&-translation\server.ts
  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleGeneration.ts
  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\server\videoSubtitleGeneration.ts

Task 3: Poll subtitle jobs from the frontend

Files:

  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\services\subtitleService.ts
  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\services\subtitleService.test.ts
  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\types.ts

Task 4: Show staged progress in the editor UI

Files:

  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\components\EditorScreen.tsx
  • Modify: E:\Downloads\ai-video-dubbing-&-translation\src\components\EditorScreen.test.tsx

Task 5: Verify focused tests and typecheck

Files:

  • Test: E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleJobs.test.ts
  • Test: E:\Downloads\ai-video-dubbing-&-translation\src\services\subtitleService.test.ts
  • Test: E:\Downloads\ai-video-dubbing-&-translation\src\components\EditorScreen.test.tsx
  • Test: E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleGeneration.test.ts
  • Test: E:\Downloads\ai-video-dubbing-&-translation\src\server\videoSubtitleGeneration.test.ts