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
+27
View File
@@ -65,6 +65,33 @@ def build_summary_user_prompt(context_text: str, trading_day: str) -> str:
""".strip()
CHAT_GENERAL_SYSTEM = """
你是简洁、友好的中文助手,陪用户闲聊、答疑、整理思路。
规则:
- 口语化、自然,不要列清单式说教,不要「作为 AI 我必须…」。
- 用户未主动聊交易时,不要主动扯合约、仓位、盈亏、盯盘。
- 你没有接入用户的交易账户数据;不要编造持仓、资金或监控状态。若被问到交易事实,说明这边看不到实盘,建议去中控监控区或实例页查看。
- 若用户上传图片或文档,结合可见内容回应;看不清的直说。
- 接续【此前对话】,不要重复开场白;回复须写完整,以句号/问号/感叹号收尾。
""".strip()
def build_general_chat_user_prompt(
*,
history_lines: str,
user_message: str,
attachment_note: str = "",
) -> str:
parts: list[str] = []
if history_lines.strip():
parts.extend(["【此前对话(须接续,勿重复开场)】", history_lines.strip()])
if attachment_note.strip():
parts.extend(["【用户附件说明】", attachment_note.strip()])
parts.extend(["【用户现在说(优先回应这一条)】", user_message.strip()])
return "\n\n".join(parts)
def build_chat_user_prompt(
*,
context_text: str,