This commit is contained in:
mm 2024-10-30 10:21:29 +05:00
parent 8caa75e388
commit 90677847f1

View File

@ -88,10 +88,17 @@ function playSpeech(text) {
body: JSON.stringify({
text: text,
}),
}).then(
response => {
audio = document.createElement('audio');
audio.src = response.blob();
})
.then(response => {
if (!response.ok) {
throw new Error('Ошибка сети: ' + response.statusText);
}
return response.blob();
})
.then(response => {
const url = URL.createObjectURL(blob);
const audio = new Audio(url);
audio.play().catch(error => {
console.error('Ошибка при воспроизведении:', error);
});