Give priority to the wav upload in the html page (#9)

This commit is contained in:
Gabriel de Marmiesse
2026-01-12 15:02:14 +01:00
committed by GitHub
parent becd3137a1
commit aab9443122
+6 -6
View File
@@ -281,16 +281,16 @@
const formData = new FormData(); const formData = new FormData();
formData.append('text', text); formData.append('text', text);
// Add voice URL if provided // Add voice URL if provided (only if no WAV file is uploaded)
const voiceUrl = document.getElementById('voice-url-input').value.trim(); const voiceUrl = document.getElementById('voice-url-input').value.trim();
if (voiceUrl) {
formData.append('voice_url', voiceUrl);
}
// Add voice WAV file if uploaded
const voiceWavFile = document.getElementById('voice-wav-input').files[0]; const voiceWavFile = document.getElementById('voice-wav-input').files[0];
if (voiceWavFile) { if (voiceWavFile) {
// If WAV file is uploaded, only use the WAV file (ignore voice URL)
formData.append('voice_wav', voiceWavFile); formData.append('voice_wav', voiceWavFile);
} else if (voiceUrl) {
// Only use voice URL if no WAV file is uploaded
formData.append('voice_url', voiceUrl);
} }
const response = await fetch('/tts', { const response = await fetch('/tts', {