feat(hub): add data dashboard and AI chat with session history
Add /dashboard with daily PnL overview and loss alerts. Extend AI coach chat with history sidebar, delete/switch sessions, message copy, and trading vs general bot modes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -648,6 +648,7 @@ def root_redirect():
|
||||
@app.get("/monitor")
|
||||
@app.get("/market")
|
||||
@app.get("/archive")
|
||||
@app.get("/dashboard")
|
||||
@app.get("/funds")
|
||||
@app.get("/ai")
|
||||
@app.get("/settings")
|
||||
@@ -661,10 +662,24 @@ def _all_exchanges_for_ai() -> list:
|
||||
|
||||
|
||||
from hub_ai.routes import create_hub_ai_router
|
||||
from hub_dashboard import build_dashboard_payload, default_trading_day
|
||||
|
||||
app.include_router(create_hub_ai_router(load_all_exchanges=_all_exchanges_for_ai))
|
||||
|
||||
|
||||
@app.get("/api/dashboard/daily")
|
||||
def api_dashboard_daily(trading_day: str = ""):
|
||||
day = (trading_day or "").strip()[:10] or default_trading_day()
|
||||
try:
|
||||
payload = build_dashboard_payload(
|
||||
_all_exchanges_for_ai(),
|
||||
trading_day=day,
|
||||
)
|
||||
except Exception as exc:
|
||||
raise HTTPException(status_code=502, detail=str(exc)) from exc
|
||||
return payload
|
||||
|
||||
|
||||
@app.get("/trade")
|
||||
def trade_removed_redirect():
|
||||
from fastapi.responses import RedirectResponse
|
||||
@@ -2107,7 +2122,7 @@ def api_ping():
|
||||
"service": "manual-trading-hub",
|
||||
"build": HUB_BUILD,
|
||||
"trade_ui": False,
|
||||
"features": ["monitor", "settings", "auth", "board_sse", "archive", "funds"],
|
||||
"features": ["monitor", "settings", "auth", "board_sse", "archive", "dashboard", "funds"],
|
||||
"board_poll_interval_sec": HUB_BOARD_POLL_INTERVAL,
|
||||
"board_version": board_store.version,
|
||||
"board_aggregating": board_store.aggregating,
|
||||
|
||||
Reference in New Issue
Block a user