auto-git:

[add] dist/assets/index-DifKT69O.js
 [change] backend/main.py
 [change] backend/schemas.py
 [change] backend/whisper_admin.py
 [change] dist/index.html
 [change] electron/main.cjs
 [change] src/App.jsx
 [change] src/GeneralSettings.jsx
 [change] src/audioInput.js
 [unlink] dist/assets/index-Dm7DZNSo.js
This commit is contained in:
2026-04-17 04:43:28 +02:00
parent 67d9f41f17
commit 48c35698cb
9 changed files with 85 additions and 14 deletions

View File

@@ -159,6 +159,7 @@ async def transcribe_audio_route(req: schemas.AudioTranscriptionRequest):
audio_bytes,
mime_type,
req.model or DEFAULT_WHISPER_MODEL,
req.language,
)
except RuntimeError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc

View File

@@ -84,6 +84,7 @@ class AudioTranscriptionRequest(BaseModel):
mime_type: str
audio_base64: str
model: Optional[str] = None
language: Optional[str] = None
class AudioTranscriptionResponse(BaseModel):

View File

@@ -241,6 +241,7 @@ def transcribe_audio_bytes(
audio_bytes: bytes,
mime_type: str,
model_name: str = DEFAULT_WHISPER_MODEL,
language: Optional[str] = None,
) -> Dict[str, Any]:
if not audio_bytes:
raise RuntimeError("Recorded audio was empty.")
@@ -256,7 +257,14 @@ def transcribe_audio_bytes(
_convert_audio_to_wav(input_path, wav_path)
source_path = wav_path
result = model.transcribe(str(source_path), task="transcribe", fp16=device == "cuda")
transcription_options = {
"task": "transcribe",
"fp16": device == "cuda",
}
if language:
transcription_options["language"] = str(language).strip().lower()
result = model.transcribe(str(source_path), **transcription_options)
return {
"model": model_name,
"device": device,