Fix #171: [Bug] STT: Azure OpenAI (Whisper) transcription returns 404...#206
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdded support for optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #171
What
Appends
?api-version=<version>to the Whisper transcription URL when theOPENAI_API_VERSIONenvironment variable is set. No behavior change for standard OpenAI usage where this var is unset.Why
Azure OpenAI endpoints require an
api-versionquery parameter on every request. Without it,POST /api/transcribereturns404 Resource not found. Previously,server/lib/constants.tsbuiltOPENAI_WHISPER_URLas a bare string with no mechanism to append query params.How
server/lib/constants.ts: Exports a newOPENAI_API_VERSIONconstant read fromprocess.env.OPENAI_API_VERSION.OPENAI_WHISPER_URLis now conditionally constructed: ifOPENAI_API_VERSIONis non-empty, the URL becomes${OPENAI_BASE_URL}/audio/transcriptions?api-version=${OPENAI_API_VERSION}; otherwise it falls back to the existing bare path.OPENAI_TTS_URLis unchanged as Azure TTS is not affected.server/lib/constants.test.ts(new file): Three Vitest cases cover the three relevant states — var unset (no query string), var set (query string appended), and Azure base URL with version (full URL shape verified).No changes to
server/services/openai-whisper.tswere needed since it already importsOPENAI_WHISPER_URLdirectly fromconstants.ts.Type of Change
Checklist
npm run lintpassesnpm run build && npm run build:serversucceedsnpm test -- --runpassesScreenshots
N/A
Summary by CodeRabbit
New Features
Tests