Spaces:
Running
Running
Update static/application.js
Browse files- static/application.js +33 -12
static/application.js
CHANGED
@@ -67,10 +67,21 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
67 |
audio.play();
|
68 |
|
69 |
icon.addEventListener("click", () => {
|
70 |
-
audio.muted
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
});
|
75 |
|
76 |
message.appendChild(icon);
|
@@ -102,8 +113,8 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
102 |
// User message with file info
|
103 |
createMessageBubble(question, "You", null, selectedFile.name);
|
104 |
|
105 |
-
//
|
106 |
-
const thinkingBubble = createMessageBubble("Wait
|
107 |
|
108 |
const formData = new FormData();
|
109 |
formData.append("question", question);
|
@@ -135,10 +146,20 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
135 |
audio.play();
|
136 |
|
137 |
icon.addEventListener("click", () => {
|
138 |
-
audio.muted
|
139 |
-
|
140 |
-
|
141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
});
|
143 |
|
144 |
message.style.display = "flex";
|
@@ -147,10 +168,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
147 |
}
|
148 |
} catch (err) {
|
149 |
const message = thinkingBubble.querySelector(".text");
|
150 |
-
message.innerText = "⚠️
|
151 |
}
|
152 |
|
153 |
-
// Clear inputs
|
154 |
input.value = "";
|
155 |
selectedFile = null;
|
156 |
}
|
|
|
67 |
audio.play();
|
68 |
|
69 |
icon.addEventListener("click", () => {
|
70 |
+
if (audio.muted) {
|
71 |
+
// When unmuting, restart from beginning
|
72 |
+
audio.currentTime = 0;
|
73 |
+
audio.muted = false;
|
74 |
+
icon.classList.remove("fa-volume-xmark");
|
75 |
+
icon.classList.add("fa-volume-high");
|
76 |
+
icon.title = "Click to mute";
|
77 |
+
audio.play();
|
78 |
+
} else {
|
79 |
+
// When muting, just mute
|
80 |
+
audio.muted = true;
|
81 |
+
icon.classList.remove("fa-volume-high");
|
82 |
+
icon.classList.add("fa-volume-xmark");
|
83 |
+
icon.title = "Click to unmute";
|
84 |
+
}
|
85 |
});
|
86 |
|
87 |
message.appendChild(icon);
|
|
|
113 |
// User message with file info
|
114 |
createMessageBubble(question, "You", null, selectedFile.name);
|
115 |
|
116 |
+
// Aidan is thinking...
|
117 |
+
const thinkingBubble = createMessageBubble("Wait, Let me think 🤔...", "Aidan");
|
118 |
|
119 |
const formData = new FormData();
|
120 |
formData.append("question", question);
|
|
|
146 |
audio.play();
|
147 |
|
148 |
icon.addEventListener("click", () => {
|
149 |
+
if (audio.muted) {
|
150 |
+
// Restart audio when unmuting
|
151 |
+
audio.currentTime = 0;
|
152 |
+
audio.muted = false;
|
153 |
+
icon.classList.remove("fa-volume-xmark");
|
154 |
+
icon.classList.add("fa-volume-high");
|
155 |
+
icon.title = "Click to mute";
|
156 |
+
audio.play();
|
157 |
+
} else {
|
158 |
+
audio.muted = true;
|
159 |
+
icon.classList.remove("fa-volume-high");
|
160 |
+
icon.classList.add("fa-volume-xmark");
|
161 |
+
icon.title = "Click to unmute";
|
162 |
+
}
|
163 |
});
|
164 |
|
165 |
message.style.display = "flex";
|
|
|
168 |
}
|
169 |
} catch (err) {
|
170 |
const message = thinkingBubble.querySelector(".text");
|
171 |
+
message.innerText = "⚠️ Aidan had trouble responding.";
|
172 |
}
|
173 |
|
174 |
+
// Clear inputs after sending
|
175 |
input.value = "";
|
176 |
selectedFile = null;
|
177 |
}
|