fixed double voices

main
alex 2024-11-19 21:59:23 +01:00
parent 4f4f90d7ad
commit 1764633554
2 changed files with 260 additions and 250 deletions

View File

@ -1,20 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
/>
<!-- Theme color for Chrome, Firefox OS and Opera --> <!-- Theme color for Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#fd9644" /> <meta name="theme-color" content="#fd9644" />
<!-- Theme color for Windows Phone --> <!-- Theme color for Windows Phone -->
<meta name="msapplication-navbutton-color" content="#fd9644" /> <meta name="msapplication-navbutton-color" content="#fd9644" />
<!-- Theme color for iOS Safari --> <!-- Theme color for iOS Safari -->
<meta <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<title>Voice Call with a voice bot</title> <title>Voice Call with a voice bot</title>
@ -66,9 +61,9 @@
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2); 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
} }
</style> </style>
</head> </head>
<body> <body>
<div class="center-container"> <div class="center-container">
<h1>Voice Call with a Voice Bot</h1> <h1>Voice Call with a Voice Bot</h1>
<button id="startCallButton" class="material-button">Start Call</button> <button id="startCallButton" class="material-button">Start Call</button>
@ -173,7 +168,7 @@
console.log("OpenAI response received:", data); console.log("OpenAI response received:", data);
try { try {
response.textContent = "Response: " + data[0].transcript; response.textContent = "Response: " + data[0].transcript;
} catch (error) {} } catch (error) { }
}); });
socket.on("debug-text-input", (data) => { socket.on("debug-text-input", (data) => {
@ -192,6 +187,7 @@
console.log("OpenAI audio start:", randomUUID); console.log("OpenAI audio start:", randomUUID);
currentAudioID = randomUUID; currentAudioID = randomUUID;
dataSum = 0; dataSum = 0;
stopAudio();
}); });
socket.on("openai-audio", async (data, randomUUID) => { socket.on("openai-audio", async (data, randomUUID) => {
@ -256,6 +252,10 @@
socket.on("bot-stopSpeaking", () => { socket.on("bot-stopSpeaking", () => {
console.log("Bot stopped speaking"); console.log("Bot stopped speaking");
stopAudio();
});
function stopAudio() {
audioQueue = []; audioQueue = [];
// Clear the audio queue fade out // Clear the audio queue fade out
@ -266,7 +266,8 @@
clearInterval(fadeOut); clearInterval(fadeOut);
} }
}, 100); }, 100);
}); }
</script> </script>
</body> </body>
</html> </html>

View File

@ -0,0 +1,9 @@
AI: Hallo hier ist Jan von Jannex, spreche ich hier mit Herr Mustermann?
User: ja babahaard
AI: Super, dass ich Sie erreiche! Ich rufe an, um kurz über KI-Möglichkeiten für Ihr Unternehmen zu sprechen. Hätten Sie kurz Zeit?
User: ja was gibt's denn
AI: Gibt es Bereiche bei Ihnen, wo Sie sich mehr Effizienz oder weniger Aufwand wünschen würden? KI kann da oft schon sehr hilfreich sein.
User: ja ich hab da zwar schon mal eine website gemacht aber
AI: Ah, ... **ABGEBROCHEN**
User: ich glaub jetzt haben wir jetzt nicht so wirklich mit dafür
AI: Total verständlich. Viele unserer Kunden waren anfangs auch skeptisch und haben trotzdem Potenziale gefunden. Ein kurzes Gespräch schadet nicht und könnte schon interessante Ansätze zeigen. Wie wäre es, wenn wir einfach mal ein KI-Audit machen, um mögliche Chancen auszuloten?