Repository navigation
TTSの日英両言語をAzure HD(DragonHD)ボイスに対応 - #6275
Conversation
Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01P99WBy9iBAZAVW4ehNukoK
Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01P99WBy9iBAZAVW4ehNukoK
Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01P99WBy9iBAZAVW4ehNukoK
📝 WalkthroughウォークスルーAzure TTS に DragonHD ボイス判定( 変更点DragonHD ボイス対応
推定コードレビュー工数🎯 3 (Moderate) | ⏱️ ~20 分 関連する可能性のある PR
提案ラベル
詩
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
functions/src/lib/azure/tts.test.ts (1)
3-57:⚠️ Potential issue | 🟡 Minor
afterEachブロックでjest.clearAllMocks()を追加してください。テストスイート全体で共通のクリアを入れることで、今後
jest.mockを追加した際の副作用を抑えられます。修正例
describe('buildAzureSsml', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + it('wraps standard neural voices with prosody/style when provided', () => {コーディングガイドライン「テストの
afterEachでjest.clearAllMocks()を呼び出してください」に対応する必要があります。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@functions/src/lib/azure/tts.test.ts` around lines 3 - 57, Add an afterEach hook inside the describe('buildAzureSsml') block that calls jest.clearAllMocks() to ensure mocks are properly cleared between test cases. This hook should be placed at the end of the describe block, after all the test cases (it() statements) that test the buildAzureSsml function.Source: Coding guidelines
functions/src/utils/ttsVoice.test.ts (1)
7-67:⚠️ Potential issue | 🟡 Minor
afterEachでjest.clearAllMocks()を追加してください。現状のテストは動作していますが、ガイドラインに従い、テストブロック内に
afterEachを追加してモック状態のリセットを明示的に行う必要があります。将来モックが追加された際のテスト間汚染を防ぐための保守性向上対策です。修正例
describe('ttsVoice (Azure)', () => { + afterEach(() => { + jest.clearAllMocks(); + }); + it('accepts Azure neural voices', () => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@functions/src/utils/ttsVoice.test.ts` around lines 7 - 67, Add an afterEach hook inside the describe block for 'ttsVoice (Azure)' that calls jest.clearAllMocks() to explicitly reset mock state between test executions. This hook should be placed after the describe statement and before the test cases to ensure consistent test isolation and prevent potential mock pollution when mocks are added in the future.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@functions/src/lib/azure/tts.test.ts`:
- Around line 3-57: Add an afterEach hook inside the describe('buildAzureSsml')
block that calls jest.clearAllMocks() to ensure mocks are properly cleared
between test cases. This hook should be placed at the end of the describe block,
after all the test cases (it() statements) that test the buildAzureSsml
function.
In `@functions/src/utils/ttsVoice.test.ts`:
- Around line 7-67: Add an afterEach hook inside the describe block for
'ttsVoice (Azure)' that calls jest.clearAllMocks() to explicitly reset mock
state between test executions. This hook should be placed after the describe
statement and before the test cases to ensure consistent test isolation and
prevent potential mock pollution when mocks are added in the future.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3621474a-19a9-4cf2-8178-30c8d718524b
📒 Files selected for processing (7)
functions/src/lib/azure/tts.test.tsfunctions/src/lib/azure/tts.tsfunctions/src/routes/tts.tsfunctions/src/types.tsfunctions/src/utils/ttsVoice.test.tsfunctions/src/utils/ttsVoice.tsfunctions/wrangler.jsonc
💤 Files with no reviewable changes (2)
- functions/src/types.ts
- functions/src/routes/tts.ts
|
@coderabbitai 理由:
将来この層でモックを導入する際には、その時点で Generated by Claude Code |
|
Tip For best results, initiate chat on the files or code changes.
🐇 ✏️ Learnings added
|
概要
TTS(Azure Speech)の日本語・英語の両言語を、標準ニューラルボイスから Azure HD(DragonHD)ボイスへ切り替えます。あわせて HD ボイスが非対応の SSML 要素(
<prosody>/<mstts:express-as>)をビルダー側で出し分け、HD 提供リージョンへエンドポイントを合わせます。変更の種類
変更内容
wrangler.jsoncの dev / production 両方)ja-JP-NanamiNeural→ja-JP-Nanami:DragonHDLatestNeuralen-US-JennyNeural→en-US-Jenny:DragonHDLatestNeuralisAzureHdVoiceName()をsrc/utils/ttsVoice.tsに追加(:DragonHD...Neuralを検出)src/lib/azure/tts.tsのbuildAzureSsmlを HD 対応化。HD ボイスでは非対応の<prosody>/<mstts:express-as>を出力しない(言語ごとにボイス解決されるため片方だけ HD でも安全)。テスト容易化のためビルダーを exportAZURE_TTS_RATEおよびrateオプションを廃止(HD は<prosody>非対応で、そもそもレート操作の必要性が薄いため)。Env.AZURE_TTS_RATE型・ルートの受け渡し・TtsOptions.rate・ビルダーの rate 生成を削除japaneast→southeastasiaへ変更。HD(DragonHD)ボイスはjapaneastで提供されておらず、最寄りの HD 提供リージョンが Southeast Asia のためttsVoice.test.ts)、HD/標準で SSML 装飾を出し分けつつ say-as 等の本文は保持すること(新規tts.test.ts)Important
マージ後、Azure 側で以下の対応が別途必要です(コードだけでは 400 が解消しません)。
AZURE_SPEECH_KEYシークレットを新リソースのキーへ差し替え(dev / production それぞれwrangler secret put AZURE_SPEECH_KEY)。キーはリージョン紐付けのため、japaneastのキーでは新エンドポイントに認証できませんテスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることfunctions/ディレクトリで実行し、いずれも成功(npm test: 6 suites / 50 tests passed)。関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit
リリースノート
New Features
Chores