feat: [rd] 사운드로고/나레이션 AI 토큰 사용량 기록 추가
- RdController: 사운드로고-AI생성, 사운드로고-TTS 토큰 기록 - CmSongController: 나레이션-가사생성, 나레이션-TTS 토큰 기록 - AI 토큰 사용량 UI에 사운드로고/나레이션 카테고리 분류 추가
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Rd;
|
||||
|
||||
use App\Helpers\AiTokenHelper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Rd\CmSong;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -114,6 +115,10 @@ public function generateLyrics(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
// 토큰 사용량 기록
|
||||
AiTokenHelper::saveGeminiUsage($data, 'gemini-2.5-flash', '나레이션-가사생성');
|
||||
|
||||
$text = $data['candidates'][0]['content']['parts'][0]['text'] ?? '';
|
||||
|
||||
return response()->json([
|
||||
@@ -165,6 +170,10 @@ public function generateAudio(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
// 토큰 사용량 기록
|
||||
AiTokenHelper::saveGeminiUsage($data, 'gemini-2.5-flash-preview-tts', '나레이션-TTS');
|
||||
|
||||
$inlineData = $data['candidates'][0]['content']['parts'][0]['inlineData'] ?? null;
|
||||
|
||||
if (! $inlineData || empty($inlineData['data'])) {
|
||||
|
||||
Reference in New Issue
Block a user