fix(stt): normalize language code to ISO 639-1 for OpenAI Whisper#1939
Merged
fix(stt): normalize language code to ISO 639-1 for OpenAI Whisper#1939
Conversation
…request (ELECTRON-G3) OpenAI Whisper API requires ISO 639-1 language codes (e.g. "en") but the languageHint and config values may arrive in BCP 47 format (e.g. "en-us"), causing 422 Unprocessable Entity responses. Extract the primary subtag before appending to the form data.
Contributor
Code Review:fix(stt): normalize language code to ISO 639-1 for OpenAI Whisper (#1939)变更概述本 PR 修复 Sentry 问题 ELECTRON-G3: 方案评估结论:✅ 方案合理 用 问题清单✅ 未发现明显问题,代码质量良好,建议批准合并。
汇总无问题。 结论✅ 批准合并 — 修复精准,测试完整,无阻塞性问题。 本报告由本地 CONCLUSION: APPROVED |
Contributor
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
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.
Summary
en) but thelanguageHintand config values may arrive in BCP 47 format (e.g.en-us), causing422 Unprocessable Entityresponseslanguage.split('-')[0].toLowerCase()) before appending to the form dataChanges
src/process/bridge/services/SpeechToTextService.ts: normalize language code beforeformData.append('language', ...)tests/unit/SpeechToTextService.test.ts: new test file covering BCP 47 → ISO 639-1 conversion, plain ISO 639-1 passthrough, no-language omission, and error response handlingVerification
Test plan
en-us→en)zh-CN→zh)