Repository navigation
feat: add top users consumption ranking to dashboard - #1
Merged
Merged
Conversation
- Add display_name field to Log model (read-only from users table) - Update GetAllLogs to fetch display_name via bulk query - Update frontend to show display_name instead of username - Add grouping dropdown with User/Hour/Model options - Implement grouping logic with aggregated stats Co-authored-by: gmij <22893579+gmij@users.noreply.github.com>
The grouping feature was querying the logs table and doing client-side aggregation, but the system has a dedicated quota_data table for aggregated statistics. Removed: - Grouping dropdown UI from filters - Client-side grouping logic (getProcessedLogs) - Grouping state management - Group summary rendering in columns The logs page is now focused on viewing detailed log records. For aggregated statistics and grouping by user/model/time, users should use the existing Data Dashboard (/api/data endpoints) which properly leverages the quota_data table. This aligns with the system architecture where: - logs table = detailed per-request records - quota_data table = hourly aggregated statistics Co-authored-by: gmij <22893579+gmij@users.noreply.github.com>
Co-authored-by: gmij <22893579+gmij@users.noreply.github.com>
gmij
marked this pull request as ready for review
March 13, 2026 10:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 类型
PR 是否包含破坏性更新?
PR 描述
Adds admin-only "用户消耗排行" (User Consumption Ranking) chart to the data dashboard showing top 10 highest consuming users by quota in descending order.
Backend Changes
GET /api/data/top-users(admin-only, configurable limit default 10, max 100)GetTopUsersByQuota()queriesquota_datatable, groups by user_id/username, sums quota, orders DESCFrontend Changes
spec_user_rank_bar) with quota formatting viarenderQuota()isAdminUsercheck)loadTopUsersData()API call integrated into dashboard refresh cycleImplementation Notes
The feature correctly uses
quota_data(pre-aggregated hourly statistics) rather than thelogstable for efficient aggregation. Chart updates reactively when time range changes or data refreshes.