10 Commits

Author SHA1 Message Date
855f376671 refactor: consolidate rankings into combined charts
- Change top models from Top 3 to Top 5
- Simplify titles: remove 'Top X' and parenthetical details
- Replace separate user tables (by amount/by count) with single ChartBar
- Replace separate provider tables with single ChartBar
- Add get_top_users_combined and get_top_providers_combined functions
2026-06-01 15:41:40 +08:00
98a28d9770 feat: 添加全局今日模型使用图表,替换用户级监控为全量监控
- 新增 get_all_today_models() 函数查询所有用户今日模型使用
- 新增 all_today_models_chart.ui 和 api/all_today_models.dspy
- index.ui 标题改为「今日模型使用(全部)」,数据源改为全量
- load_path.py 注册新路径权限
- 保留原有 user_today_models 供后续个性化需求使用
2026-05-31 10:01:28 +08:00
929ee0e319 feat: 添加客户专属监控 - 组织级每日/每月模型调用统计
- 新增5个后端函数: customer_daily/monthly_models, daily/monthly_summary, daily_trend
- 新增customer_usage.ui主页面: 4个汇总卡片 + 日趋势折线图 + 日/月模型柱状图
- 新增3个API端点(.dspy)和3个图表UI组件
- index.ui添加客户专属监控入口卡片
- RBAC权限配置已更新(load_path.py)
2026-05-31 08:07:25 +08:00
69b7ec5cd0 feat: add user-level model usage chart (我的今日模型使用)
- Add get_user_today_models() function to load_dashboard.py
  Shows current user's today model call counts and amounts
- Create api/user_today_models.dspy endpoint
- Create user_today_models_chart.ui ChartBar widget (30s auto-refresh)
- Add '我的今日模型使用' card section to index.ui with refresh button
- Register new paths in load_path.py (logined permission)
2026-05-31 08:00:22 +08:00
87dc6da0af fix: top_models.dspy return data via 'return' instead of 'print' 2026-05-26 11:14:56 +08:00
ffdc7fc983 feat: modern UI redesign - shell layout, theme switching, dashboard revamp
Phase 1-2 deliverables:
- shell.ui: Global layout framework (topbar + collapsible sidebar + main content)
- shell_theme.css: Dark/light theme CSS custom properties system
- shell_theme.js: Theme toggle + sidebar collapse with localStorage persistence
- global_menu.ui: Unified module navigation menu with RBAC visibility
- index.ui: Redesigned dashboard homepage with modern stat cards + quick links
- Stat card widgets: today_usage, today_amount, total_users, concurrent, errors
- chart_top_models.ui + api/top_models.dspy: ChartBar with data_url pattern
- table_top_users_amount.ui: Jinja2-rendered user ranking table
- build.sh: Added .css file linking support

Design system:
- Dark theme (default): slate color palette (#0B1120, #111827, #1E293B)
- Light theme: clean white palette with matching structure
- Theme persisted in localStorage, toggled via topbar button
- Sidebar collapsible with icon-only mode, state persisted in localStorage
- Responsive stat cards with hover effects and trend indicators
- Quick link cards for model management, users, knowledge base, errors
2026-05-25 16:53:36 +08:00
a2a6e9a2d5 refactor: use individual RefreshWidget per stat card with Jinja2 .ui templates
Architecture:
- load_dashboard.py: async data functions registered via load_dashboard()
- init.py: calls load_dashboard() to expose on ServerEnv
- Individual .ui files (Jinja2 templates):
  - today_usage.ui: calls get_today_usage(request)
  - today_amount.ui: calls get_today_amount(request)
  - total_users.ui: calls get_total_users(request)
  - concurrent_users.ui: calls get_concurrent_users(request)
  - top_models_chart.ui: calls get_top_models(request) for ChartBar
- index.ui: each stat card wrapped in own RefreshWidget (10s period)
- Removed deprecated .dspy files (dashboard_cards, get_today_usage,
  get_user_stats, get_top_models)
2026-05-24 17:20:22 +08:00
d2210a2996 refactor: use RefreshWidget for stat cards + fix .dspy import violations
Architecture:
- index.ui: title + RefreshWidget(cards) + ChartBar with refresh_period
- RefreshWidget wraps dashboard_cards.dspy → returns full card widget tree
  with live data (cnt, amount, total_users, concurrent_users)
- ChartBar handles its own auto-refresh via refresh_period: 10
- No more JS polling file needed

.dspy import fixes:
- get_today_usage.dspy: remove import json, from datetime import date
- get_user_stats.dspy: remove from datetime import datetime, timedelta
- get_top_models.dspy: remove from datetime import date
- All use pre-loaded datetime module (datetime.date.today(), etc.)
- dashboard_cards.dspy: same pattern, no imports

Permission:
- load_path.py: add dashboard_cards.dspy logined
2026-05-24 16:45:45 +08:00
99e6fed5ef refactor: replace JS polling with RefreshWidget
- Delete dashboard_refresh.js (no longer needed)
- Add api/dashboard_content.dspy returns dynamic UI with live data
  (queries llmusage + users tables server-side, returns full widget tree)
- Simplify index.ui to use RefreshWidget with period_seconds=10
- ChartBar in dashboard_content.dspy auto-fetches top models via data_url
- load_path.py updated separately in sage repo
2026-05-24 16:31:29 +08:00
6ae20954f3 Initial commit: dashboard module for Sage with auto-refresh statistics 2026-05-24 14:06:38 +08:00