repaire sentences

This commit is contained in:
2026-10-21 19:39:04 +08:00
parent 176d722c77
commit 532d9900ba
13 changed files with 1233 additions and 60 deletions

View File

@@ -116,6 +116,23 @@ class SubtitleTranslationService:
except (KeyError, ValueError, AITutorError):
logger.exception("Could not restart subtitle translation: video=%s", video_hash)
def start_missing(self, video_hash: str) -> None:
"""Translate sentences that still lack Chinese text, keeping existing ones."""
if not getattr(self.ai_tutor, "available", False):
return
document = self.repository.get_document(video_hash)
if document is None:
return
if self.snapshot(document).complete:
return
try:
self._start_if_needed(video_hash)
except (KeyError, ValueError, AITutorError):
logger.exception(
"Could not start subtitle translation after gap repair: video=%s",
video_hash,
)
def admin_snapshot(self, video_hash: str) -> AdminSubtitleTranslationResponse | None:
current = self.current(video_hash)
if current is None: