aryan12345ark commited on
Commit
1aa83b3
Β·
verified Β·
1 Parent(s): df8c816

Update dashboard.py

Browse files
Files changed (1) hide show
  1. dashboard.py +37 -19
dashboard.py CHANGED
@@ -1,12 +1,10 @@
1
  import streamlit as st
2
- import time
3
  import os
 
4
 
5
  st.set_page_config(page_title="AryanBot Dashboard", page_icon="πŸ€–", layout="wide")
6
-
7
  st.title("πŸ€– AryanBot Command Center")
8
 
9
- # Status Indicators
10
  col1, col2, col3 = st.columns(3)
11
  with col1:
12
  st.metric("Service", "OpenClaw Agent", "Running")
@@ -17,24 +15,44 @@ with col3:
17
 
18
  st.divider()
19
 
20
- # Log Viewer
21
- st.subheader("πŸ“‹ Live System Logs")
22
- log_placeholder = st.empty()
23
 
24
- # Function to read logs
25
  def get_logs():
26
  log_file = "/app/bot.log"
27
  if os.path.exists(log_file):
28
  with open(log_file, "r") as f:
29
- # Read last 50 lines
30
- lines = f.readlines()
31
- return "".join(lines[-50:])
32
- return "Waiting for bot startup..."
33
-
34
- # Auto-refresh loop
35
- if st.button("Refresh Logs"):
36
- st.code(get_logs(), language="bash")
37
- else:
38
- # Default view
39
- st.code(get_logs(), language="bash")
40
- st.caption("Auto-refreshing is disabled to save resources. Click Refresh to update.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
 
2
  import os
3
+ import subprocess
4
 
5
  st.set_page_config(page_title="AryanBot Dashboard", page_icon="πŸ€–", layout="wide")
 
6
  st.title("πŸ€– AryanBot Command Center")
7
 
 
8
  col1, col2, col3 = st.columns(3)
9
  with col1:
10
  st.metric("Service", "OpenClaw Agent", "Running")
 
15
 
16
  st.divider()
17
 
18
+ if st.button("πŸ”„ Refresh"):
19
+ st.rerun()
 
20
 
 
21
  def get_logs():
22
  log_file = "/app/bot.log"
23
  if os.path.exists(log_file):
24
  with open(log_file, "r") as f:
25
+ return f.read()
26
+ return "Waiting..."
27
+
28
+ log_content = get_logs()
29
+
30
+ sections = [
31
+ "ALL COMMANDS", "GATEWAY SUBCOMMANDS",
32
+ "DOCTOR FIX", "CONFIG AFTER DOCTOR",
33
+ "FINAL CONFIG",
34
+ "STARTING GATEWAY", "TRYING NODE CONNECT",
35
+ "GATEWAY INTERNAL LOG"
36
+ ]
37
+
38
+ for section in sections:
39
+ marker = f"========== {section} =========="
40
+ if marker in log_content:
41
+ with st.expander(f"πŸ“ {section}"):
42
+ start = log_content.index(marker) + len(marker)
43
+ next_pos = len(log_content)
44
+ for s in sections:
45
+ m = f"========== {s} =========="
46
+ idx = log_content.find(m, start)
47
+ if idx > 0 and idx < next_pos:
48
+ next_pos = idx
49
+ st.code(log_content[start:next_pos].strip(), language="bash")
50
+
51
+ # Also show "trying:" blocks
52
+ trying_blocks = [l for l in log_content.split('\n') if '--- trying:' in l or 'error:' in l.lower() or 'unknown' in l.lower()]
53
+ if trying_blocks:
54
+ with st.expander("πŸ” Command Discovery Results", expanded=True):
55
+ st.code('\n'.join(trying_blocks), language="bash")
56
+
57
+ with st.expander("πŸ“„ Raw Log (last 3000 chars)"):
58
+ st.code(log_content[-3000:], language="bash")