Repository navigation
fix(wtf_transcribe): use the dialog's mediatype, not always audio/wav - #210
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wtf_transcribetook the audio content type fromdialog.get("mimetype", "audio/wav"). The conserver's read compat layer renames legacymimetypetomediatype, and current adapters writemediatype, so the lookup always fell through toaudio/wav. MP3, Opus or other non-WAV dialogs reached the transcription service labelled as WAV.Changes
dialog_mediatype(dialog)resolves in order:mediatype; legacymimetype; a guess fromfilenameviamimetypes.guess_type, kept only when it isaudio/*orvideo/*; thenaudio/wav.dialog_mimetypestays as an alias; the unit test imported it and nothing else does.mimetypereferences checked:common/lib/vcon_compat.pyandvcon_egress_compat.pyrename between the two names on purpose and are unchanged.api/api.py'sDialogEntrydeclares and validatesmimetype; it allows extra fields, so an incomingmediatypepasses through unvalidated but is not lost.Tests
test_dialog_mediatype_resolution_order:mediatypeused; legacymimetypeused;mediatypewins overmimetype;clip.ogggivesaudio/ogg;clip.txtfalls through toaudio/wav; nothing givesaudio/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