auto-save 2026-05-17 13:56 (~4)

This commit is contained in:
2026-05-17 13:56:10 +08:00
parent 5a871492d6
commit c4b6980dd0
4 changed files with 19 additions and 9 deletions

View File

@@ -1793,6 +1793,8 @@ def _validate_asr_segments(segments: list[dict], duration: float, source: str) -
raise TranscriptionUnavailable(f"{source} returned timestamps outside audio duration")
if duration > 10 and last_end < duration * 0.45 and words < 20:
raise TranscriptionUnavailable(f"{source} returned too little transcript coverage")
for item in clean:
item["_source"] = source
return clean
@@ -2064,6 +2066,7 @@ def _audio_profile_model_sync(wav: Path, segments: list[TranscriptSegment], targ
response_format={"type": "json_object"},
temperature=0.1,
max_tokens=900,
timeout=ASR_TIMEOUT_SECONDS,
)
content = (resp.choices[0].message.content or "").strip()
data = json.loads(content)
@@ -2322,6 +2325,7 @@ def pipeline_transcribe(job_id: str, manage_job_status: bool = True) -> None:
segments = _transcribe_sync(wav)
if not segments:
raise TranscriptionUnavailable("ASR 未返回可用字幕段")
asr_source = str(segments[0].get("_source") or ASR_MODEL)
# 先把英文段落落到 job 上(让 UI 提前看到,翻译再补 zh
en_only = [
@@ -2368,7 +2372,7 @@ def pipeline_transcribe(job_id: str, manage_job_status: bool = True) -> None:
if manage_job_status:
update(job, transcript=full, status="transcribed", progress=100,
audio_script=audio_script,
message=f"音频解析完成 · {len(full)} 段({ASR_MODEL} + {TRANSLATE_MODEL} + {ASR_FALLBACK_MODEL} 音频分析)")
message=f"音频解析完成 · {len(full)} 段({asr_source} + {TRANSLATE_MODEL} + {ASR_FALLBACK_MODEL} 音频分析)")
else:
update(job, transcript=full, audio_script=audio_script)