fix(tts): scope retranslation TTS to target language only
When retranslate=True, _generate_tts_for_languages was receiving the full outputs dict (all 9 languages) and regenerating TTS + render for every language on every single-language retranslation task. That multiplied API calls by 8x and triggered unnecessary renders. Now passes only the target language outputs when retranslate=True. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b873f0af6d
commit
f38325b461
1 changed files with 8 additions and 1 deletions
|
|
@ -312,8 +312,15 @@ async def _async_translate_and_synthesize(job_id: str, languages: list[str] | No
|
|||
if job_doc["requested_outputs"]["audio_description_mp3"]:
|
||||
# Get TTS preferences from job
|
||||
tts_preferences = job_doc["requested_outputs"].get("tts_preferences", {})
|
||||
# For retranslation, only regenerate TTS for the specific target languages —
|
||||
# not all languages. Regenerating all is wasteful and triggers unwanted renders.
|
||||
tts_outputs = (
|
||||
{lang: updated_outputs[lang] for lang in target_languages if lang in updated_outputs}
|
||||
if retranslate
|
||||
else updated_outputs
|
||||
)
|
||||
await _generate_tts_for_languages(
|
||||
job_id, updated_outputs, db, source_language, tts_preferences, accessible_video_requested,
|
||||
job_id, tts_outputs, db, source_language, tts_preferences, accessible_video_requested,
|
||||
user_id=_cost_ctx["user_id"], cost_project_id=_cost_ctx["project_id"],
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue