feat(hub): mobile AI one-screen and dashboard monitor counts

Fix mobile AI to scroll only in the chat area. Dashboard cards show monitor item counts with expand-to-fullscreen and color-coded position floating P&L.
This commit is contained in:
dekun
2026-06-11 11:27:28 +08:00
parent 1042fdeef3
commit 08ae171e48
7 changed files with 237 additions and 57 deletions
+15 -24
View File
@@ -652,41 +652,32 @@ def format_account_remark(ac: dict) -> str:
return "".join(parts)
def format_dashboard_account_lines(ac: dict) -> list[dict[str, Any]]:
"""数据看板分户卡片:监控持仓逐行展示(含浮盈亏数值供前端着色)。"""
lines: list[dict[str, Any]] = []
def format_dashboard_account_detail(ac: dict) -> dict[str, Any]:
"""数据看板分户卡片:监控仅数量,持仓逐行(含浮盈亏)。"""
mon = ac.get("monitor_lines") or {}
for row in (mon.get("keys") or [])[:3]:
if row:
lines.append({"kind": "monitor", "text": str(row)})
for row in (mon.get("orders") or [])[:3]:
if row:
lines.append({"kind": "monitor", "text": str(row)})
for row in (mon.get("trends") or [])[:2]:
if row:
lines.append({"kind": "monitor", "text": str(row)})
for row in (mon.get("rolls") or [])[:2]:
if row:
lines.append({"kind": "monitor", "text": str(row)})
position_lines: list[dict[str, Any]] = []
for p in _filter_open_positions(ac.get("positions") or []):
sym = p.get("symbol") or "?"
side = p.get("side") or "?"
upnl = _position_float_pnl(p)
lines.append(
position_lines.append(
{
"kind": "position",
"text": f"{sym} {side}",
"pnl": round(upnl, 4),
}
)
if not lines:
issues = ac.get("issues") or []
if issues:
for iss in issues[:3]:
lines.append({"kind": "issue", "text": str(iss)})
else:
lines.append({"kind": "empty", "text": ""})
return lines
issues = [str(x) for x in (ac.get("issues") or [])[:3]]
return {
"monitor_counts": {
"keys": len(mon.get("keys") or []),
"orders": len(mon.get("orders") or []),
"trends": len(mon.get("trends") or []),
"rolls": len(mon.get("rolls") or []),
},
"position_lines": position_lines,
"issues": issues,
}
def collect_closed_trades_snapshot(