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:
dekun
2026-06-11 10:42:33 +08:00
parent a45a3b18e2
commit 582ada7e60
11 changed files with 1479 additions and 55 deletions
+211 -1
View File
@@ -3939,7 +3939,8 @@ body.hub-page-ai #page-ai {
}
body.hub-page-ai .ai-layout[data-ai-mobile-tab="chat"] .ai-summary-panel,
body.hub-page-ai .ai-layout[data-ai-mobile-tab="summary"] .ai-chat-panel {
body.hub-page-ai .ai-layout[data-ai-mobile-tab="summary"] .ai-chat-panel,
body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-summary-panel {
display: none !important;
}
@@ -3953,6 +3954,35 @@ body.hub-page-ai #page-ai {
min-width: 0;
}
body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-panel {
display: flex;
flex: 1 1 auto;
width: 100%;
max-width: 100%;
min-height: 0;
min-width: 0;
}
body.hub-page-ai .ai-layout[data-ai-mobile-tab="chat"] .ai-chat-history-panel {
display: none !important;
}
body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-main {
display: none !important;
}
body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-bot-bar {
display: none;
}
body.hub-page-ai .ai-layout[data-ai-mobile-tab="history"] .ai-chat-history-panel {
display: flex;
flex: 1 1 auto;
min-height: 0;
border-left: none;
width: 100%;
}
body.hub-page-ai .ai-panel {
width: 100%;
max-width: 100%;
@@ -4291,6 +4321,186 @@ body.hub-page-ai #page-ai {
color: var(--muted);
margin: 0;
}
.ai-chat-panel {
gap: 8px;
}
.ai-chat-panel .ai-chat-split {
flex: 1 1 auto;
}
.ai-bot-bar {
display: flex;
gap: 8px;
flex-shrink: 0;
padding-bottom: 2px;
}
.ai-bot-tab {
flex: 1;
min-height: 36px;
padding: 6px 12px;
border-radius: 8px;
border: 1px solid var(--border-soft);
background: var(--inset-surface);
color: var(--muted);
font-family: var(--font);
font-size: 0.8rem;
font-weight: 600;
cursor: pointer;
transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ai-bot-tab:hover {
border-color: var(--accent);
color: var(--text);
}
.ai-bot-tab.is-active {
color: var(--text);
border-color: var(--accent);
background: var(--accent-dim);
box-shadow: var(--glow);
}
.ai-chat-split {
flex: 1 1 auto;
min-height: 0;
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
gap: 0;
overflow: hidden;
border: 1px solid var(--border-soft);
border-radius: 8px;
}
.ai-chat-main {
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
overflow: hidden;
}
.ai-chat-history-panel {
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
border-left: 1px solid var(--border-soft);
background: color-mix(in srgb, var(--inset-surface) 65%, var(--panel));
}
.ai-chat-history-head {
flex-shrink: 0;
padding: 10px 12px 6px;
border-bottom: 1px solid var(--border-soft);
}
.ai-chat-history-head h3 {
margin: 0;
font-size: 0.82rem;
font-weight: 700;
color: var(--muted);
letter-spacing: 0.04em;
}
.ai-chat-history-list {
flex: 1 1 auto;
min-height: 0;
padding: 8px;
display: flex;
flex-direction: column;
gap: 6px;
}
.ai-chat-history-item {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 4px 8px;
align-items: start;
padding: 8px 10px;
border-radius: 8px;
border: 1px solid var(--border-soft);
background: var(--panel);
cursor: pointer;
text-align: left;
transition: border-color 0.15s, background 0.15s;
}
.ai-chat-history-item:hover {
border-color: var(--accent);
}
.ai-chat-history-item.is-active {
border-color: var(--accent);
background: var(--accent-dim);
box-shadow: var(--glow);
}
.ai-chat-history-item-main {
min-width: 0;
display: flex;
flex-direction: column;
gap: 3px;
}
.ai-chat-history-item-title {
font-size: 0.8rem;
font-weight: 600;
color: var(--text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ai-chat-history-item-preview {
font-size: 0.72rem;
color: var(--muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ai-chat-history-item-meta {
font-size: 0.68rem;
color: var(--muted);
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
}
.ai-chat-history-badge {
display: inline-flex;
padding: 1px 6px;
border-radius: 999px;
font-size: 0.62rem;
font-weight: 600;
border: 1px solid var(--border-soft);
color: var(--muted);
}
.ai-chat-history-badge.trading {
color: var(--accent);
border-color: color-mix(in srgb, var(--accent) 40%, var(--border-soft));
}
.ai-chat-history-del {
min-width: 28px;
min-height: 28px;
padding: 0;
border: none;
border-radius: 6px;
background: transparent;
color: var(--muted);
font-size: 1rem;
line-height: 1;
cursor: pointer;
}
.ai-chat-history-del:hover {
color: var(--red);
background: color-mix(in srgb, var(--red) 12%, transparent);
}
.ai-msg-actions {
display: flex;
gap: 6px;
padding: 0 4px;
}
.ai-msg-copy-btn {
min-height: 24px;
padding: 2px 8px;
border-radius: 6px;
border: 1px solid var(--border-soft);
background: var(--panel);
color: var(--muted);
font-size: 0.68rem;
font-weight: 600;
cursor: pointer;
}
.ai-msg-copy-btn:hover {
border-color: var(--accent);
color: var(--accent);
}
.ai-chat-messages {
display: flex;
flex-direction: column;