Spaces:
Sleeping
Sleeping
Moshe Ofer
commited on
Commit
·
3df6a65
1
Parent(s):
b8e37ed
Initial commit for Hugging Face Space
Browse files- templates/index.html +10 -14
templates/index.html
CHANGED
@@ -401,7 +401,9 @@
|
|
401 |
transports: ['websocket'],
|
402 |
reconnection: true,
|
403 |
reconnectionAttempts: 5,
|
404 |
-
reconnectionDelay: 1000
|
|
|
|
|
405 |
});
|
406 |
let beams = {};
|
407 |
let completedBeams = [];
|
@@ -421,19 +423,13 @@
|
|
421 |
console.log('Received beam update:', data); // Add logging
|
422 |
const { beam_idx, text } = data;
|
423 |
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
// Force a reflow to ensure the update is visible
|
432 |
-
beamElement.style.display = 'none';
|
433 |
-
beamElement.offsetHeight; // Force reflow
|
434 |
-
beamElement.style.display = 'block';
|
435 |
-
}
|
436 |
-
});
|
437 |
});
|
438 |
|
439 |
socket.on('beam_finished', function(data) {
|
|
|
401 |
transports: ['websocket'],
|
402 |
reconnection: true,
|
403 |
reconnectionAttempts: 5,
|
404 |
+
reconnectionDelay: 1000,
|
405 |
+
path: '/socket.io/', // Explicitly set the path
|
406 |
+
upgrade: false // Disable transport upgrades
|
407 |
});
|
408 |
let beams = {};
|
409 |
let completedBeams = [];
|
|
|
423 |
console.log('Received beam update:', data); // Add logging
|
424 |
const { beam_idx, text } = data;
|
425 |
|
426 |
+
if (!beams[beam_idx]) {
|
427 |
+
createBeamContainer(beam_idx);
|
428 |
+
}
|
429 |
+
const beamElement = document.getElementById(`beam-${beam_idx}`);
|
430 |
+
if (beamElement) {
|
431 |
+
beamElement.textContent = text;
|
432 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
});
|
434 |
|
435 |
socket.on('beam_finished', function(data) {
|