Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
server/wildfire_web_interface.py
CHANGED
|
@@ -590,9 +590,15 @@ def get_wildfire_web_interface_html(metadata: Optional[EnvironmentMetadata] = No
|
|
| 590 |
}};
|
| 591 |
|
| 592 |
this.ws.onmessage = (event) => {{
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
}}
|
| 597 |
}};
|
| 598 |
|
|
@@ -854,13 +860,21 @@ def get_wildfire_web_interface_html(metadata: Optional[EnvironmentMetadata] = No
|
|
| 854 |
}}
|
| 855 |
|
| 856 |
updateUI(episodeState) {{
|
|
|
|
| 857 |
// Update state display
|
| 858 |
-
document.getElementById('env-status')
|
| 859 |
-
|
| 860 |
-
document.getElementById('
|
| 861 |
-
|
| 862 |
-
|
| 863 |
-
episodeState.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 864 |
|
| 865 |
// Update observation if available
|
| 866 |
if (episodeState.current_observation) {{
|
|
|
|
| 590 |
}};
|
| 591 |
|
| 592 |
this.ws.onmessage = (event) => {{
|
| 593 |
+
try {{
|
| 594 |
+
const data = JSON.parse(event.data);
|
| 595 |
+
console.log('WebSocket message received:', data.type, data);
|
| 596 |
+
if (data.type === 'state_update') {{
|
| 597 |
+
console.log('Updating UI from WebSocket state_update:', data.episode_state);
|
| 598 |
+
this.updateUI(data.episode_state);
|
| 599 |
+
}}
|
| 600 |
+
}} catch (error) {{
|
| 601 |
+
console.error('Error parsing WebSocket message:', error, event.data);
|
| 602 |
}}
|
| 603 |
}};
|
| 604 |
|
|
|
|
| 860 |
}}
|
| 861 |
|
| 862 |
updateUI(episodeState) {{
|
| 863 |
+
console.log('updateUI called with episodeState:', episodeState);
|
| 864 |
// Update state display
|
| 865 |
+
const statusEl = document.getElementById('env-status');
|
| 866 |
+
const episodeIdEl = document.getElementById('episode-id');
|
| 867 |
+
const stepCountEl = document.getElementById('step-count');
|
| 868 |
+
|
| 869 |
+
if (statusEl) {{
|
| 870 |
+
statusEl.textContent = episodeState.is_reset ? 'Reset' : 'Running';
|
| 871 |
+
}}
|
| 872 |
+
if (episodeIdEl) {{
|
| 873 |
+
episodeIdEl.textContent = episodeState.episode_id || '-';
|
| 874 |
+
}}
|
| 875 |
+
if (stepCountEl) {{
|
| 876 |
+
stepCountEl.textContent = episodeState.step_count.toString();
|
| 877 |
+
}}
|
| 878 |
|
| 879 |
// Update observation if available
|
| 880 |
if (episodeState.current_observation) {{
|