diff --git a/app/Http/Controllers/RdController.php b/app/Http/Controllers/RdController.php index 18439262..3f70fc9a 100644 --- a/app/Http/Controllers/RdController.php +++ b/app/Http/Controllers/RdController.php @@ -485,6 +485,8 @@ public function soundLogoTts(Request $request): JsonResponse { $request->validate([ 'text' => 'required|string|max:200', + 'voice_name' => 'nullable|string|max:30', + 'voice_style' => 'nullable|string|max:100', ]); $apiKey = config('services.gemini.api_key'); @@ -494,8 +496,18 @@ public function soundLogoTts(Request $request): JsonResponse return response()->json(['success' => false, 'error' => 'Gemini API 키가 설정되지 않았습니다.'], 500); } - // 짧은 텍스트는 TTS 모델이 텍스트 생성으로 인식할 수 있으므로 발화 컨텍스트 추가 + $voiceName = $request->voice_name ?: 'Kore'; + $voiceStyle = $request->voice_style ?: ''; + + // TTS에 전달할 텍스트 구성 $ttsText = $request->text; + + // 스타일 지시가 있으면 프롬프트로 감싸기 + if ($voiceStyle) { + $ttsText = "{$voiceStyle}: {$ttsText}"; + } + + // 짧은 텍스트는 TTS 모델이 텍스트 생성으로 인식할 수 있으므로 발화 컨텍스트 추가 if (mb_strlen($ttsText) < 4) { $ttsText = "'{$ttsText}' "; } @@ -512,7 +524,7 @@ public function soundLogoTts(Request $request): JsonResponse 'speechConfig' => [ 'voiceConfig' => [ 'prebuiltVoiceConfig' => [ - 'voiceName' => 'Kore', + 'voiceName' => $voiceName, ], ], ], diff --git a/resources/views/rd/sound-logo/index.blade.php b/resources/views/rd/sound-logo/index.blade.php index 6585bc22..dd8c7422 100644 --- a/resources/views/rd/sound-logo/index.blade.php +++ b/resources/views/rd/sound-logo/index.blade.php @@ -353,7 +353,22 @@
음성 오버레이 (TTS)
- + + + + + + + +