main
UI Deploy (Next-Auth Support) 🎨 / build-and-deploy (push) Has been cancelled

This commit is contained in:
Harun CAN
2026-05-11 08:00:13 +02:00
parent fc5ceeebb6
commit ecf0612205
2 changed files with 29 additions and 1 deletions
@@ -3,7 +3,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { motion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { voiceboxApi } from '@/services/voiceboxApi'; import { voiceboxApi } from '@/services/voiceboxApi';
import { Play, Download, Mic, Settings2, Loader2, Sparkles, Volume2, AlertTriangle, History, Clock, ChevronDown, ChevronUp } from 'lucide-react'; import { Play, Download, Mic, Settings2, Loader2, Sparkles, Volume2, AlertTriangle, History, Clock, ChevronDown, ChevronUp, Trash2 } from 'lucide-react';
export default function VoiceBoxStudio() { export default function VoiceBoxStudio() {
const [text, setText] = useState(''); const [text, setText] = useState('');
@@ -105,6 +105,17 @@ export default function VoiceBoxStudio() {
document.body.removeChild(a); document.body.removeChild(a);
}; };
const handleDeleteHistory = async (id: string) => {
if (!confirm('Bu geçmiş kaydını silmek istediğinize emin misiniz?')) return;
try {
await voiceboxApi.deleteHistory(id);
setHistoryItems(prev => prev.filter(item => item.id !== id));
} catch (error) {
alert('Kayıt silinirken bir hata oluştu.');
}
};
const insertTag = (tag: string) => { const insertTag = (tag: string) => {
setText((prev) => (prev ? `${prev} ${tag}` : tag)); setText((prev) => (prev ? `${prev} ${tag}` : tag));
}; };
@@ -389,6 +400,13 @@ export default function VoiceBoxStudio() {
> >
<Download className="w-3.5 h-3.5" /> <Download className="w-3.5 h-3.5" />
</button> </button>
<button
onClick={() => handleDeleteHistory(item.id)}
className="p-1.5 rounded-md border border-border/50 hover:bg-red-500/20 hover:text-red-400 transition-colors"
title="Sil"
>
<Trash2 className="w-3.5 h-3.5" />
</button>
</div> </div>
</div> </div>
)) ))
+10
View File
@@ -58,6 +58,16 @@ export const voiceboxApi = {
} }
}, },
deleteHistory: async (id: string) => {
try {
const response = await clientMap.core.delete(`/voicebox/history/${id}`);
return response.data;
} catch (error) {
console.error(`Error deleting VoiceBox history for ${id}:`, error);
throw error;
}
},
getAudioUrl: (generationId: string) => { getAudioUrl: (generationId: string) => {
// API endpoint for `<audio src="...">` tag // API endpoint for `<audio src="...">` tag
return `${process.env.NEXT_PUBLIC_CORE_API_URL || 'http://localhost:3000/api'}/voicebox/audio/${generationId}`; return `${process.env.NEXT_PUBLIC_CORE_API_URL || 'http://localhost:3000/api'}/voicebox/audio/${generationId}`;