Conversation
CRITICAL fixes: - findDailyModelLeaderboard() already exists in leaderboard.ts (verified) HIGH priority fixes: - Fix timezone inconsistency in getOverviewMetrics() - use SQL AT TIME ZONE - Add Promise.allSettled for robust parallel data fetching with fallbacks - Add comprehensive error logging for partial failures MEDIUM priority fixes: - Replace magic numbers with constants (ACTIVITY_STREAM_LIMIT, MODEL_DISTRIBUTION_LIMIT) - Add logging for provider rankings lookup with null checks - Correct trend data calculation from ChartDataItem structure - Simplify error count SQL using FILTER syntax Code quality improvements: - Translate Chinese comment to English in provider-slots.ts - Fix user ranking progress bar normalization (relative to top user) - Remove unused imports (XAxis, YAxis, locale, DashboardRealtimeData) - Fix TypeScript type errors in error handling paths All type checks pass ✅
✨ 新增功能 - 实现 Live Stream 混合数据源 (Redis + Database) - 优化 Traffic Trend 图表展示和实时截断 - 添加语言循环切换功能 🐛 Bug 修复 - 修复 Model Distribution 数据为空问题 (COALESCE originalModel) - 修复进行中请求显示 0ms 耗时问题 - 修复语言切换器无响应问题 🎨 UI/UX 优化 - Traffic Trend 提升至中间位置,突出重要性 - 添加坐标轴标签 (XAxis: 小时, YAxis: 请求数) - 实时截断未来时间数据点 (避免误导性 0 值) - Provider Slot 按占用率排序,最多显示 3 个 - 供应商排行改为按金额降序排序 - 合并 CONCURRENCY 和 ACTIVE SESSIONS 指标 - 过滤未设置并发限额的供应商 📦 数据层改进 - 新增 activity-stream.ts repository - 使用窗口函数优化 session 查询 - 修复 Model Distribution 查询 NULL 处理 - 实时耗时计算 (durationMs ?? now - startTime) 🔧 技术优化 - Live Stream 最多 20 条 (活跃 + 历史混合) - Traffic Trend 2 秒自动刷新 - 语言切换支持 5 种语言循环 - 所有修改通过 TypeScript 类型检查
Feat/data dashboard
Summary of ChangesHello @ding113, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求引入了全新的“数据大屏”功能,旨在提供一个全面的实时监控仪表盘。它将各种系统指标、用户和供应商排名、流量趋势以及实时活动流聚合到一个动态视图中。实现内容包括新的服务器端数据获取操作、对现有数据检索逻辑的更新以纳入错误率等新指标,以及一个全新的仪表盘用户界面组件,并支持多语言国际化。 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
🔒 Security Scan Results✅ No security vulnerabilities detected This PR has been scanned against OWASP Top 10, CWE Top 25, and common security anti-patterns. No security issues were identified in the code changes. Scanned Categories
Security Strengths Observed
Review Methodology
🤖 Automated security scan performed by Claude AI - OWASP Top 10 & CWE coverage |
Summary
添加实时数据监控大屏功能,提供全屏可视化仪表盘,实时展示系统运行状态、供应商负载、用户排行榜和流量趋势。
Problem
管理员和运维人员需要一个直观的全屏监控界面来实时监控系统状态:
Solution
新增独立的数据大屏页面
/internal/dashboard/big-screen,包含:核心指标卡片:
可视化组件:
交互功能:
Changes
后端 API
新增 Server Action:
getDashboardRealtimeData()(src/actions/dashboard-realtime.ts)Promise.allSettled实现部分失败容错)allowGlobalUsageView=true可访问新增 Server Action:
getProviderSlots()(src/actions/provider-slots.ts)SessionTracker.getProviderSessionCount()增强现有 API:
getOverviewData(): 新增todayErrorRate字段getActiveSessions,findDailyLeaderboard,getUserStatistics等前端页面
src/app/[locale]/internal/dashboard/big-screen/page.tsx(917 行)国际化
新增 5 个语言文件
messages/{locale}/bigScreen.json:变更日志
CHANGELOG.md: 记录数据大屏功能上线Testing
/internal/dashboard/big-screenallowGlobalUsageView=false)被拒绝访问Screenshots
建议管理员添加数据大屏的实际截图
Related Issues
Part of Dashboard enhancement roadmap (#183)
访问路径: 登录管理后台 → 访问
/internal/dashboard/big-screen权限要求: 管理员角色 或 系统设置允许全局数据查看