auto-save 2026-05-17 13:23 (~2)

This commit is contained in:
2026-05-17 13:23:56 +08:00
parent f2742df3c6
commit 6d684e058f
2 changed files with 10 additions and 7 deletions

View File

@@ -43,6 +43,7 @@ LLM_BASE_URL = os.getenv("LLM_BASE_URL", "").strip()
LLM_API_KEY = os.getenv("LLM_API_KEY", "").strip()
ASR_MODEL = os.getenv("ASR_MODEL", "whisper-1")
ASR_FALLBACK_MODEL = os.getenv("ASR_FALLBACK_MODEL", "gemini-2.5-flash").strip() or "gemini-2.5-flash"
ASR_TIMEOUT_SECONDS = max(15, int(os.getenv("ASR_TIMEOUT_SECONDS", "45")))
TRANSLATE_MODEL = os.getenv("TRANSLATE_MODEL", "gemini-2.5-flash")
REWRITE_MODEL = os.getenv("REWRITE_MODEL", "gemini-2.5-pro")
VISION_MODEL = os.getenv("VISION_MODEL", "gemini-2.5-flash")
@@ -1752,6 +1753,7 @@ def _transcribe_gemini_sync(wav: Path) -> list[dict]:
{"type": "input_audio", "input_audio": {"data": audio_b64, "format": "wav"}},
]}],
temperature=0,
timeout=ASR_TIMEOUT_SECONDS,
)
content = (resp.choices[0].message.content or "").strip()
return _parse_asr_segments(content, duration)
@@ -1771,6 +1773,7 @@ def _transcribe_sync(wav: Path) -> list[dict]:
model=ASR_MODEL,
response_format="verbose_json",
timestamp_granularities=["segment"],
timeout=ASR_TIMEOUT_SECONDS,
)
raw = resp.model_dump() if hasattr(resp, "model_dump") else resp
segments = raw.get("segments") or []