fix(eo): normalize MIME type before validation (strip codec params)
- "audio/webm;codecs=opus" → "audio/webm" before isAcceptedAudioMime check
- Normalized MIME propagated to Gemini transcribeAudio
Typecheck: OK · Tests: 248/248 ✅
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8f8a900449
commit
ff46cf61a5
1 changed files with 6 additions and 2 deletions
|
|
@ -394,7 +394,11 @@ export async function correctEO(
|
|||
// 3. Mode batch audio : transcrire d'abord. Mode transcript direct : passer.
|
||||
let transcript: string;
|
||||
if (input.audioBase64 && input.mimeType) {
|
||||
if (!isAcceptedAudioMime(input.mimeType)) {
|
||||
// Normalisation du MIME : `MediaRecorder` côté navigateur produit souvent
|
||||
// un type complet `audio/webm;codecs=opus`. La whitelist Gemini compare
|
||||
// par égalité stricte → on conserve uniquement la partie principale.
|
||||
const normalizedMime = input.mimeType.split(";", 1)[0]!.trim();
|
||||
if (!isAcceptedAudioMime(normalizedMime)) {
|
||||
return {
|
||||
error: true,
|
||||
code: "VALIDATION_ERROR",
|
||||
|
|
@ -404,7 +408,7 @@ export async function correctEO(
|
|||
};
|
||||
}
|
||||
try {
|
||||
transcript = await transcribeAudio(input.audioBase64, input.mimeType);
|
||||
transcript = await transcribeAudio(input.audioBase64, normalizedMime);
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
console.error("[correctionController.correctEO] transcription failed", {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue