Dmitry Beresnev commited on
Commit ·
e890083
1
Parent(s): d9e0f07
add openclaw standard ui, etc
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from pathlib import Path
|
|
| 8 |
import pandas as pd
|
| 9 |
import requests
|
| 10 |
import streamlit as st
|
|
|
|
| 11 |
from tools.backtesting_runner import (
|
| 12 |
load_price_data_from_csv_text,
|
| 13 |
load_price_data_from_yfinance,
|
|
@@ -21,6 +22,7 @@ OPENCLAW_BIN_ENV = os.getenv("OPENCLAW_BIN", "openclaw")
|
|
| 21 |
CONFIG_PATH = Path(os.getenv("OPENCLAW_CONFIG_PATH", "openclaw.json"))
|
| 22 |
ENV_EXAMPLE_PATH = Path("config/openclaw.env.example")
|
| 23 |
LOG_MAX_LINES = 300
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
def resolve_openclaw_bin() -> str | None:
|
|
@@ -267,6 +269,30 @@ with action_col:
|
|
| 267 |
|
| 268 |
st.divider()
|
| 269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
cfg_col, env_col = st.columns(2)
|
| 271 |
|
| 272 |
with cfg_col:
|
|
@@ -294,15 +320,20 @@ with env_col:
|
|
| 294 |
else:
|
| 295 |
checks = []
|
| 296 |
for key in expected_vars:
|
| 297 |
-
|
| 298 |
checks.append(
|
| 299 |
{
|
| 300 |
"name": key,
|
| 301 |
-
"status": "
|
| 302 |
-
"
|
| 303 |
}
|
| 304 |
)
|
| 305 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
|
| 307 |
st.divider()
|
| 308 |
|
|
|
|
| 8 |
import pandas as pd
|
| 9 |
import requests
|
| 10 |
import streamlit as st
|
| 11 |
+
import streamlit.components.v1 as components
|
| 12 |
from tools.backtesting_runner import (
|
| 13 |
load_price_data_from_csv_text,
|
| 14 |
load_price_data_from_yfinance,
|
|
|
|
| 22 |
CONFIG_PATH = Path(os.getenv("OPENCLAW_CONFIG_PATH", "openclaw.json"))
|
| 23 |
ENV_EXAMPLE_PATH = Path("config/openclaw.env.example")
|
| 24 |
LOG_MAX_LINES = 300
|
| 25 |
+
OPENCLAW_STANDARD_UI_URL = os.getenv("OPENCLAW_STANDARD_UI_URL", "http://127.0.0.1:18789/")
|
| 26 |
|
| 27 |
|
| 28 |
def resolve_openclaw_bin() -> str | None:
|
|
|
|
| 269 |
|
| 270 |
st.divider()
|
| 271 |
|
| 272 |
+
st.subheader("OpenClaw Standard UI")
|
| 273 |
+
std_ui_status_col, std_ui_embed_col = st.columns([1, 3])
|
| 274 |
+
with std_ui_status_col:
|
| 275 |
+
ui_ok = False
|
| 276 |
+
ui_status_text = "Unavailable"
|
| 277 |
+
try:
|
| 278 |
+
ui_resp = requests.get(OPENCLAW_STANDARD_UI_URL, timeout=2)
|
| 279 |
+
ui_ok = ui_resp.status_code < 400
|
| 280 |
+
ui_status_text = "Available" if ui_ok else f"HTTP {ui_resp.status_code}"
|
| 281 |
+
except Exception:
|
| 282 |
+
ui_ok = False
|
| 283 |
+
st.markdown(
|
| 284 |
+
f"Status: {':green_circle:' if ui_ok else ':red_circle:'} {ui_status_text}"
|
| 285 |
+
)
|
| 286 |
+
st.caption(f"URL: {OPENCLAW_STANDARD_UI_URL}")
|
| 287 |
+
|
| 288 |
+
with std_ui_embed_col:
|
| 289 |
+
if ui_ok:
|
| 290 |
+
components.iframe(OPENCLAW_STANDARD_UI_URL, height=560, scrolling=True)
|
| 291 |
+
else:
|
| 292 |
+
st.info("Standard UI is not reachable yet. Start gateway and refresh.")
|
| 293 |
+
|
| 294 |
+
st.divider()
|
| 295 |
+
|
| 296 |
cfg_col, env_col = st.columns(2)
|
| 297 |
|
| 298 |
with cfg_col:
|
|
|
|
| 320 |
else:
|
| 321 |
checks = []
|
| 322 |
for key in expected_vars:
|
| 323 |
+
is_set = bool(os.getenv(key, ""))
|
| 324 |
checks.append(
|
| 325 |
{
|
| 326 |
"name": key,
|
| 327 |
+
"status": "available" if is_set else "missing",
|
| 328 |
+
"color": "green" if is_set else "red",
|
| 329 |
}
|
| 330 |
)
|
| 331 |
+
for item in checks:
|
| 332 |
+
st.markdown(
|
| 333 |
+
f"<span style='color:{item['color']}'>●</span> "
|
| 334 |
+
f"<b>{item['name']}</b> - {item['status']}",
|
| 335 |
+
unsafe_allow_html=True,
|
| 336 |
+
)
|
| 337 |
|
| 338 |
st.divider()
|
| 339 |
|