Luigi commited on
Commit
0b7b937
·
1 Parent(s): 9674f50

fix update volume meter display

Browse files
Files changed (1) hide show
  1. 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
- if (msg.partial) {
125
- partial.textContent = msg.partial;
126
- console.log(`[DEBUG client] Raw volume from server: ${msg.volume.toFixed(5)}`);
127
- const amplified = Math.min(msg.volume * 20.0, 1.0);
128
- console.log(`[DEBUG client] Amplified (×20): ${amplified.toFixed(3)}`);
129
- vol.value = amplified;
130
- } else if (msg.final) {
131
- console.log("[DEBUG client] Final:", msg.final);
132
- finalText.textContent = msg.final;
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>