Spaces:
Sleeping
Sleeping
Update static/index.html
Browse files- static/index.html +5 -1
static/index.html
CHANGED
@@ -148,7 +148,10 @@
|
|
148 |
addMessage("Bot", botMessage, "bot-message");
|
149 |
chatHistoryArray.push({ sender: "Bot", message: botMessage });
|
150 |
if (data.audioUrl) {
|
151 |
-
|
|
|
|
|
|
|
152 |
}
|
153 |
} catch (error) {
|
154 |
botTyping.remove();
|
@@ -162,6 +165,7 @@
|
|
162 |
// Play audio from server response
|
163 |
function playAudio(url) {
|
164 |
if (!url) {
|
|
|
165 |
console.error("Audio URL is missing.");
|
166 |
addMessage("Bot", "Error: Unable to play audio.", "bot-message");
|
167 |
return;
|
|
|
148 |
addMessage("Bot", botMessage, "bot-message");
|
149 |
chatHistoryArray.push({ sender: "Bot", message: botMessage });
|
150 |
if (data.audioUrl) {
|
151 |
+
const baseUrl = window.location.origin; // Get the base URL (e.g., http://localhost:8000)
|
152 |
+
const fullAudioUrl = `${baseUrl}/${data.audioUrl}`; // Append the audio URL to the base
|
153 |
+
playAudio(fullAudioUrl);
|
154 |
+
|
155 |
}
|
156 |
} catch (error) {
|
157 |
botTyping.remove();
|
|
|
165 |
// Play audio from server response
|
166 |
function playAudio(url) {
|
167 |
if (!url) {
|
168 |
+
|
169 |
console.error("Audio URL is missing.");
|
170 |
addMessage("Bot", "Error: Unable to play audio.", "bot-message");
|
171 |
return;
|