fix(transcription): repair AssemblyAI deprecation, add providers, harden upload/YouTube crashes#73
Open
steethebutcher wants to merge 1 commit into
Conversation
…den upload/YouTube crashes - AssemblyAI: switch deprecated singular speech_model to plural speech_models list (universal-3-pro/universal-2); legacy aliases mapped (ports FujiwaraChoki#47) - Transcription: add TRANSCRIPTION_PROVIDER (assemblyai|whisper|youtube_captions) with local Whisper word-timestamps and YouTube caption extraction (ports FujiwaraChoki#55) - Upload: raise backend size limit to configurable MAX_VIDEO_UPLOAD_BYTES (default 12 GB); frontend was 12 GB but backend still hardcoded 1 GB -> HTTP 413 - DB pool: release Depends(get_db) session before FileResponse/ffmpeg export in clip file/export routes + idle_in_transaction_session_timeout safety net (FujiwaraChoki#50) - YouTube crash: clean up downloaded source videos on success/error paths; recover tasks stuck in "processing" via PROCESSING_TASK_TIMEOUT_SECONDS - Tests: +4 (speech_models mapping, whisper dispatch, whisper-dict format/cache)
|
@steethebutcher is attempting to deploy a commit to the Shiori LLC Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes transcription crashes from the deprecated AssemblyAI
speech_modelparameter, integrates multiple transcription providers, hardens several YouTube/upload crash paths, and raises the local-upload size limit so large files actually upload.Background & PR review
Reviewed the open PRs targeting the transcription/AssemblyAI area. Several attempt the same fix but none merge cleanly (all target a pre-#63 base before the
_assemblyai_speech_model_valuerefactor), so the logic was ported onto currentmain:speech_models) → integrated (adapted)output_type/result_type/app_configparams)cleanup_settings"crash" they fix is already fixed onmain)Changes
1. AssemblyAI deprecation fix (
video_utils.py)AssemblyAI deprecated the singular
speech_model(best/nano/universal) server-side; requests now require the pluralspeech_modelslist (universal-3-pro,universal-2). Replaced_assemblyai_speech_model_value→_assemblyai_speech_models_value, mapping legacy aliases:nano/universal-2→["universal-2"]; everything else →["universal-3-pro", "universal-2"].2. Transcription provider choice (
TRANSCRIPTION_PROVIDER)New config:
assemblyai(default) |whisper|youtube_captions.cache_transcript_data,format_transcript_for_analysis,_serialize_transcript_wordare now polymorphic (AssemblyAI objects + Whisper dicts).generate_transcriptnow threadssource_urlso the youtube_captions provider works.3. Local upload size limit (the large-upload bug)
The frontend cap was raised to 12 GB but the backend still hardcoded 1 GB, so large uploads hit
POST /uploadand were rejected with HTTP 413. Made the limit configurable (MAX_VIDEO_UPLOAD_BYTES, default 12 GB) and fixed stale "under 1 GB" client messages.4. Connection-pool exhaustion (#50)
get_clip_file/export_clipheld theDepends(get_db)session open for the wholeFileResponse/ffmpeg export → "idle in transaction" →QueuePoolexhaustion under normal playback. Addedawait db.close()after the clip lookup in both routes, plus anidle_in_transaction_session_timeoutsafety net on the engine.5. YouTube/download crash hardening
cleanup_downloaded_files)."processing"were stuck forever (only"queued"stale tasks were recovered). Added_is_stale_processing_task+PROCESSING_TASK_TIMEOUT_SECONDS(default 4h, safely above arq's 3hjob_timeout).Env / config impact
New optional env vars (all have safe defaults, backward compatible):
TRANSCRIPTION_PROVIDER(defaultassemblyai)MAX_VIDEO_UPLOAD_BYTES(default12000000000)PROCESSING_TASK_TIMEOUT_SECONDS(default14400)No DB migrations.
Verification
python -m compileall srcclean; all edited modules import without cycles.speech_modelsmapping, Whisper provider dispatch, Whisper-dict formatting & caching).test_burn_ass_subtitles_passes_selected_fonts_dir) is pre-existing on cleanmain— a Windows path-escaping artifact in an ffmpeg filter, unrelated to this change.Manual verification steps
TRANSCRIPTION_PROVIDER=assemblyai: confirmspeech_modelsrequest succeeds (no more deprecation 400).TRANSCRIPTION_PROVIDER=whisper: short video transcribes locally, subtitles align.