fixed a bug:translate maybe timeout

This commit is contained in:
2026-10-03 19:49:21 +08:00
parent 6bd64ee4a9
commit 9daea7b807
10 changed files with 554 additions and 99 deletions

View File

@@ -100,10 +100,13 @@ The endpoint requires a signed-in user and accepts only the sentence and course
context. `AI_API_URL` and `AI_API_KEY` remain on the server and are never sent
to the mobile clients.
`POST /api/v1/videos/{sha256}/subtitle-translation` translates the full English
transcript in one AI request, then stores one Chinese caption per sentence.
Later requests reuse the cached Chinese captions until the English sentences
change.
Chinese captions are stored on the course in the server database and shared by
every user. `GET /api/v1/videos/{sha256}/subtitle-translation` returns the saved
captions without calling the AI. `POST` generates any missing captions in small
windows with neighboring context, runs several windows in parallel, retries and
splits a window if the model response is invalid, and writes each finished
window immediately so later viewers can reuse it. English sentence edits clear
the saved Chinese captions for that course.
## Assessment