fix(transcription): address review nits on PR #3253

- Correct api_key type hint to str | None in _post_transcription_with_retry
- Remove unreachable final return ""
- Fix test_openai_missing_api_key_short_circuits to actually test
  missing-key path (use audio_file fixture so file exists)
- Fix PermissionError patch for Windows (patch class method instead
  of instance attribute)
This commit is contained in:
chengyongru committed 2026-05-06 15:52:29 +08:00
1 parent 7ebf611be8
commit 3437ff273f
2 files changed
+5 -8

No files matched your search

+1 -3
View File
@@ -26,7 +26,7 @@ _RETRYABLE_EXCEPTIONS = (
async def _post_transcription_with_retry(
url: str,
*,
api_key: str,
api_key: str | None,
path: Path,
model: str,
provider_label: str,
@@ -116,8 +116,6 @@ async def _post_transcription_with_retry(
return ""
return payload.get("text", "")
return ""
class OpenAITranscriptionProvider:
"""Voice transcription provider using OpenAI's Whisper API."""