Spaces:
Running
Running
fix update volume meter display
Browse files- app/static/index.html +15 -10
app/static/index.html
CHANGED
@@ -121,16 +121,21 @@
|
|
121 |
ws.onmessage = e => {
|
122 |
console.log("[DEBUG client] Received server message:", e.data);
|
123 |
const msg = JSON.parse(e.data);
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
134 |
};
|
135 |
});
|
136 |
</script>
|
|
|
121 |
ws.onmessage = e => {
|
122 |
console.log("[DEBUG client] Received server message:", e.data);
|
123 |
const msg = JSON.parse(e.data);
|
124 |
+
// Always update the meter if we have a volume
|
125 |
+
if (msg.volume !== undefined) {
|
126 |
+
console.log(`[DEBUG client] Raw volume from server: ${msg.volume.toFixed(5)}`);
|
127 |
+
const scaled = Math.min(msg.volume * 20.0, 1.0);
|
128 |
+
console.log(`[DEBUG client] Meter value: ${scaled.toFixed(3)}`);
|
129 |
+
vol.value = scaled;
|
130 |
+
}
|
131 |
+
// And separately handle transcription updates
|
132 |
+
if (msg.partial) {
|
133 |
+
partial.textContent = msg.partial;
|
134 |
+
}
|
135 |
+
if (msg.final) {
|
136 |
+
console.log("[DEBUG client] Final:", msg.final);
|
137 |
+
finalText.textContent = msg.final;
|
138 |
+
}
|
139 |
};
|
140 |
});
|
141 |
</script>
|