Spaces:
Sleeping
Sleeping
Update dashboard.py
Browse files- 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 |
-
|
| 21 |
-
st.
|
| 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 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|