Skip to content

fix(wtf_transcribe): use the dialog's mediatype, not always audio/wav - #210

Merged
howethomas merged 1 commit into
mainfrom
thomashowe/con-1115-wtf-mediatype
Sep 26, 2026
Merged

howethomas merged 1 commit into
mainfrom
thomashowe/con-1115-wtf-mediatype

Conversation

@howethomas

Copy link
Copy Markdown
Contributor

wtf_transcribe took the audio content type from dialog.get("mimetype", "audio/wav"). The conserver's read compat layer renames legacy mimetype to mediatype, and current adapters write mediatype, so the lookup always fell through to audio/wav. MP3, Opus or other non-WAV dialogs reached the transcription service labelled as WAV.

Changes

  • dialog_mediatype(dialog) resolves in order: mediatype; legacy mimetype; a guess from filename via mimetypes.guess_type, kept only when it is audio/* or video/*; then audio/wav.
  • dialog_mimetype stays as an alias; the unit test imported it and nothing else does.
  • Other mimetype references checked: common/lib/vcon_compat.py and vcon_egress_compat.py rename between the two names on purpose and are unchanged. api/api.py's DialogEntry declares and validates mimetype; it allows extra fields, so an incoming mediatype passes through unvalidated but is not lost.

Tests

  • New test_dialog_mediatype_resolution_order: mediatype used; legacy mimetype used; mediatype wins over mimetype; clip.ogg gives audio/ogg; clip.txt falls through to audio/wav; nothing gives audio/wav.
  • conserver/links/wtf_transcribe/: 15 passed (14 on main). Non-Docker suite: 704 passed, 20 skipped (703 on main).

Refs CON-1115

🤖 Generated with Claude Code

…lting

dialog_mimetype() only read the legacy "mimetype" key, but the conserver's
read-compat layer renames it to "mediatype" and modern adapters write
"mediatype" directly, so the multipart upload to vfun always fell back to
audio/wav regardless of the real format (MP3, Opus, etc.).

Renamed to dialog_mediatype() with a resolution order: mediatype, legacy
mimetype, guessed from the filename extension, else audio/wav default.
Kept dialog_mimetype as a backward-compatible alias. Grepped
conserver/links, common, and api for other dialog mimetype reads; the
only other non-test hit is api/api.py's DialogEntry.mimetype field
validator, which validates incoming legacy API input rather than reading
an existing dialog for a content-type, so it was left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@howethomas
howethomas merged commit e027ed6 into main Sep 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant