Feature/user token model access#3024
Open
ooptsd wants to merge 5 commits into
Open
Conversation
added 5 commits
April 8, 2026 23:14
- 改进模型选择界面:添加精美图标和动画效果 - 使用 Sparkles/Check/X 图标增强视觉体验 - 添加渐变背景和悬停动画效果 - 完善 user_token 模块的中文翻译 - 更新所有默认显示文本为中文
- 在 ProxyMonitor 表格中新增用户列,显示发起请求的终端用户名 - 同步更新12种语言的国际化翻译 - 支持未使用 User Token 时显示 '-'
问题原因: - get_user_token_summary 函数将 today_requests 硬编码为 0 修复方案: - 从 security_db 模块调用 get_ip_stats() 获取真实的今日请求数 - 该函数从 ip_access_logs 表统计 timestamp >= 今日零点 的记录数
- 后端:UserTokenStats 添加 today_tokens 字段 - 后端:从 token_stats 模块获取 24 小时内的 tokens 统计 - 前端:统计卡片布局从 4 列改为 5 列,新增今日 Tokens 卡片 - 新增 Zap 图标显示,使用黄色主题
在用户令牌管理页面中,为使用量列添加点击排序功能。用户可以通过点击表头按使用量进行升序或降序排列,排序时显示箭头图标以指示当前排序方向。使用 useMemo 优化排序性能,避免不必要的重新计算。
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.
🚀 增强用户 Token 管理功能
📋 概述
本 PR 为 Antigravity-Manager 添加了多项用户 Token 管理增强功能,包括模型访问控制、使用量统计优化、国际化支持和 UI 改进。
✨ 新增功能
1. 模型访问控制 (Model Access Control)
UserToken结构体新增allowed_models字段allowed_models列,使用 JSON 格式存储模型列表2. 今日 Tokens 统计
UserTokenStats新增today_tokens字段token_stats模块获取真实统计数据3. 修复今日请求数显示问题
today_requests硬编码为 0security_db::get_ip_stats()获取真实数据ip_access_logs表统计今日请求4. 流量日志用户列
5. 模型选择 UI 优化
🌍 国际化更新
同步更新 12 种语言的翻译文件:
ar.json(阿拉伯语)en.json(英语)es.json(西班牙语)ja.json(日语)ko.json(韩语)my.json(缅甸语)pt.json(葡萄牙语)ru.json(俄语)tr.json(土耳其语)vi.json(越南语)zh-TW.json(繁体中文)zh.json(简体中文)📊 改动统计
🔧 详细改动
后端改动 (
src-tauri/src/)commands/user_token.rs
security_db和token_stats模块today_tokens统计字段today_requests数据获取modules/user_token_db.rs
UserToken新增allowed_models字段allowed_models列proxy/middleware/auth.rs
前端改动 (
src/)pages/UserToken.tsx (+375 行)
components/proxy/ProxyMonitor.tsx
✅ 测试建议
Token 创建
统计功能
代理监控
国际化
🎯 使用场景
📝 提交历史
feat(user-token): 优化模型选择UI并完善中文翻译feat(proxy): 流量日志列表增加用户列fix: 修复 user-token 页面今日请求数始终显示0的问题feat: user-token 页面新增今日 Tokens 统计卡片feat(用户令牌): 添加按使用量排序功能💡 感谢您的审核! 如有任何问题,欢迎在评论区讨论。🎉