Wesley Liddick
313afe14ce
Merge pull request #842 from pkssssss/fix/openai-ws-usage-refresh
...
fix: 修复 OpenAI WS 用量窗口刷新与限额状态不同步
2026-03-08 20:34:54 +08:00
erio
2475d4a205
feat: add marquee selection box overlay during drag-to-select
...
Show a semi-transparent blue rectangle overlay while dragging to
select rows, matching the project's primary color theme with dark
mode support. The box spans the full table width from drag start
to current mouse position.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-08 01:45:22 +08:00
神乐
0debe0a80c
fix: 修复 OpenAI WS 用量窗口刷新与限额纠偏
2026-03-07 20:02:58 +08:00
erio
05527b13db
feat: add quota limit for API key accounts
...
- Add configurable spending limit (quota_limit) for apikey-type accounts
- Atomic quota accumulation via PostgreSQL JSONB operations on TotalCost
- Scheduler filters out over-quota accounts with outbox-triggered snapshot refresh
- Display quota usage ($used / $limit) in account capacity column
- Add "Reset Quota" action in account menu to reset usage to zero
- Editing account settings preserves quota_used (no accidental reset)
- Covers all 3 billing paths: Anthropic, Gemini, OpenAI RecordUsage
chore: bump version to 0.1.90.4
2026-03-06 00:35:09 +08:00
guoyongchang
3a089242f8
feat: 支持基于 crontab 的定时账号测试
...
每个测试计划绑定一个账号和一个模型,按 cron 表达式定期执行测试,
保存历史结果并在前端账号管理页面中提供完整的增删改查和结果查看功能。
主要变更:
- 新增 scheduled_test_plans / scheduled_test_results 两张表及迁移
- 后端 service 层:CRUD 服务 + 后台 cron runner(每分钟扫描到期计划并发执行)
- RunTestBackground 方法通过 httptest 在内存中执行账号测试并解析 SSE 输出
- Redis leader lock + pg_try_advisory_lock 双重保障多实例部署只执行一次
- REST API:5 个管理端点(计划 CRUD + 结果查询)
- 前端 ScheduledTestsPanel 组件:计划管理、启用开关、内联编辑、结果展开查看
- 中英文 i18n 支持
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-03-05 16:06:05 +08:00
shaw
078fefed03
fix: 修复账号管理页面容量列显示为0的bug
2026-03-05 09:48:00 +08:00
xvhuan
80ae592c23
perf(admin): optimize large-dataset loading for dashboard/users/accounts/ops
2026-03-04 13:45:49 +08:00
QTom
607237571f
fix: address code review issues for RPM limiting feature
...
- Use TxPipeline (MULTI/EXEC) instead of Pipeline for atomic INCR+EXPIRE
- Filter negative values in GetBaseRPM(), update test expectation
- Add RPM batch query (GetRPMBatch) to account List API
- Add warn logs for RPM increment failures in gateway handler
- Reset enableRpmLimit on BulkEditAccountModal close
- Use union type 'tiered' | 'sticky_exempt' for rpmStrategy refs
- Add design decision comments for rdb.Time() RTT trade-off
2026-02-28 20:37:37 +08:00
yangjianbo
bb664d9bbf
feat(sync): full code sync from release
2026-02-28 15:01:20 +08:00
cagedbird043
e350aab1bd
fix(frontend): 批量编辑添加跨平台模型映射警告与过滤
...
- 新增 selectedPlatforms prop,从父组件传入选中账号的平台集合
- 根据选中平台过滤模型列表与预设映射按钮,避免误操作
- 混选多平台时显示 amber 警告横幅,提醒用户注意映射适用性
- 仅警告不阻断,保持加法兼容
2026-02-26 15:24:50 +08:00
yangjianbo
987589eabc
Merge branch 'test' into release
2026-02-21 10:07:53 +08:00
yangjianbo
41d0383fb7
merge(test): 合并 main 并解决前端筛选器冲突
2026-02-15 22:04:06 +08:00
yangjianbo
06b0f62e79
feat(accounts): 自动刷新改为ETag增量同步并优化单账号更新体验
...
- 前端自动刷新改为 ETag/304 增量合并,减少全量重刷
- 单账号更新后增加静默窗口,避免刚更新即被自动刷新覆盖
- 列表筛选移除时改为待同步提示,不再立即触发全量补页
- 后端账号列表支持 If-None-Match,命中返回 304
- 单账号接口统一补充运行时容量字段并暴露 ETag 头
2026-02-14 13:22:51 +08:00
yangjianbo
f23318fbcf
fix(frontend): 同步账号本地移除后的分页状态
2026-02-14 12:35:35 +08:00
yangjianbo
9cafa46dd3
fix(accounts): 账号管理改为单行增量更新并避免全量刷新
...
- 将编辑与重新授权成功事件改为回传更新后的账号对象
- 在账号列表页按 id 就地补丁更新单行数据并保留运行时容量字段
- 单账号操作(刷新凭证/清错/清限流/临时不可调度重置)改为单行更新
- 后端增强 clear-rate-limit 接口,返回更新后的账号对象
- 同步前端 clearRateLimit API 类型定义
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com >
2026-02-14 12:06:17 +08:00
kyx236
fe1d46a8ea
feat(admin): Add group filtering for account listings
...
- Add groupID parameter to ListAccounts and ListWithFilters methods
- Implement account filtering by group ID in repository query
- Add group query parameter parsing in account handler
- Update all ListAccounts/ListWithFilters call sites with groupID parameter
- Add group filter UI component to AccountTableFilters
- Add i18n translations for group filter label in English and Chinese
- Update API contract and test stubs to reflect new signature
- Enable filtering accounts by their assigned groups in admin panel
2026-02-12 03:47:06 +08:00
shaw
bd7fdb5e6c
refactor(frontend): 调整账号页面错误透传规则按钮位置
...
将错误透传规则按钮从自动刷新按钮前面移动到后面
2026-02-06 16:38:06 +08:00
LLLLLLiulei
7319122e92
merge upstream/main
2026-02-06 11:33:45 +08:00
shaw
39e05a2dad
feat: 新增全局错误透传规则功能
...
支持管理员配置上游错误如何返回给客户端:
- 新增 ErrorPassthroughRule 数据模型和 Ent Schema
- 实现规则的 CRUD API(/admin/error-passthrough-rules)
- 支持按错误码、关键词匹配,支持 any/all 匹配模式
- 支持按平台过滤(anthropic/openai/gemini/antigravity)
- 支持透传或自定义响应状态码和错误消息
- 实现两级缓存(Redis + 本地内存)和多实例同步
- 集成到 gateway_handler 的错误处理流程
- 新增前端管理界面组件
- 新增单元测试覆盖核心匹配逻辑
优化:
- 移除 refreshLocalCache 中的冗余排序(数据库已排序)
- 后端 Validate() 增加匹配条件非空校验
2026-02-05 21:52:54 +08:00
LLLLLLiulei
0c660f8335
feat: refine proxy export and toolbar layout
2026-02-05 18:35:00 +08:00
LLLLLLiulei
ce9a247a9d
feat: add proxy import flow
2026-02-05 18:23:49 +08:00
LLLLLLiulei
b4bd46d067
feat: add data import/export bundle
2026-02-05 17:46:08 +08:00
shaw
f9ab1daa3c
feat: 保存并显示OAuth账号邮箱地址
2026-01-23 15:17:47 +08:00
ducky
ff74f517df
feat(frontend): 账号表格默认排序/持久化 + 自动刷新 + 更多菜单外部关闭
2026-01-21 22:43:25 +08:00
Gemini Wen
53534d3956
style(admin): 统一列设置按钮位置到刷新按钮右侧
...
将订阅管理和账号管理页面的列设置按钮移动到刷新按钮右侧,
与用户管理页面保持一致的布局。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-20 00:18:51 +08:00
墨颜
4f4c9679bf
fix(groups): 用户分组不下发内部路由信息
...
- 普通用户 Group DTO 移除 model_routing/account_count/account_groups,避免泄露内部路由与账号信息\n- 新增 AdminGroup DTO,并仅在管理员分组接口返回完整字段\n- 前端拆分 Group/AdminGroup,管理端页面与 API 使用 AdminGroup\n- 增加 /api/v1/groups/available 契约测试,防止回归
2026-01-19 18:58:42 +08:00
Gemini Wen
45e8598d32
feat(admin): 添加账号管理和订阅管理的列设置功能
...
- 账号管理新增代理列显示和列设置下拉菜单
- 订阅管理新增列设置,支持用户列在邮箱/用户名间切换
- 列设置持久化到 localStorage
- 统一列设置图标样式
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-18 11:57:07 +08:00
shaw
7379423325
feat: 添加5h窗口费用控制和会话数量限制
...
- 支持Anthropic OAuth/SetupToken账号的5h窗口费用阈值控制
- 支持账号级别的并发会话数量限制
- 使用Redis缓存窗口费用(30秒TTL)减少数据库压力
- 费用计算基于标准费用(不含账号倍率)
2026-01-16 23:36:52 +08:00
IanShaw027
8b95d16220
refactor(ops): 简化自动刷新定时器逻辑
...
- 合并双定时器为单一倒计时定时器
- 倒计时归零时触发数据刷新
- 添加自定义时间范围的安全回退
2026-01-15 22:07:23 +08:00
IanShaw027
23aa69f56f
refactor(ops): 优化任务心跳和组件刷新机制
...
后端改动:
- 添加 ops_job_heartbeats.last_result 字段记录任务执行结果
- 优化告警评估器统计信息(规则数/事件数/邮件数)
- 统一各定时任务的心跳记录格式
前端改动:
- 重构 OpsConcurrencyCard 使用父组件统一控制刷新节奏
- 移除独立的 5 秒刷新定时器,改用 refreshToken 机制
- 修复 TypeScript 类型错误
2026-01-15 21:31:55 +08:00
yangjianbo
1bb4c76deb
fix(账号管理): 移除调度切换后的冗余列表刷新
...
切换账号调度状态后,updateSchedulableInList 已完成局部更新,
无需再调用 load() 刷新整个列表。此修改减少不必要的 API 请求,
避免 UI 闪烁。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-15 15:57:47 +08:00
yangjianbo
90bce60b85
feat: merge dev
2026-01-15 15:14:44 +08:00
shaw
68ba866c38
fix(frontend): 修复账号管理页面分组显示和 Cookie 授权问题
...
- 新增 AccountGroupsCell 组件优化分组列显示(最多4个+折叠)
- 修复 Cookie 自动授权时 group_ids/notes/expires_at 字段丢失
- 修复 SettingsView 流超时配置前后端字段不一致问题
2026-01-12 16:08:44 +08:00
yangjianbo
32953405b1
fix(账号管理): 调度批量结果明细与刷新优化
...
补充批量调度返回 success_ids/failed_ids 并增加合约/单测
前端加入降级处理与部分失败提示,表格行使用稳定 key
测试: make test-frontend
测试: go test ./internal/service -run BulkUpdateAccounts -tags=unit
测试: go test ./internal/server -run APIContracts -tags=unit
2026-01-11 20:22:17 +08:00
IanShaw027
5e936fbf0e
feat(admin): 添加账号批量调度开关功能
...
- 后端:支持批量更新账号的 schedulable 字段
- 在 BulkUpdateAccountsRequest 中添加 schedulable 参数
- 在 AccountBulkUpdate 中添加 schedulable 字段支持
- 更新 repository 层批量更新 SQL 逻辑
- 前端:在账号管理页面添加批量调度控制
- 新增"批量启用调度"和"批量停止调度"按钮
- 添加 handleBulkToggleSchedulable 处理函数
- 显示具体的成功提示信息(包含操作账号数量)
- 国际化:添加批量调度相关中英文翻译
- 优化:添加 search 参数标准化和验证(account_handler)
2026-01-09 19:26:32 +08:00
IanShaw027
514f5802b5
fix(fe): 修复中优先级表格功能问题
...
修复的问题:
1. **搜索和筛选防抖不同步**(AccountsView.vue)
- 问题:筛选器使用 reload(立即),搜索使用 debouncedReload(300ms延迟)
- 修复:统一使用 debouncedReload,避免多余的API调用
2. **useTableLoader 竞态条件**(useTableLoader.ts)
- 问题:finally 块检查 signal.aborted 而不是 controller 实例
- 修复:检查 abortController === currentController
3. **改进错误处理**(UsersView.vue)
- 添加详细错误消息:error.response?.data?.detail || error.message
- 用户可以看到具体的错误原因而不是通用消息
4. **分页边界检查**(useTableLoader.ts, UsersView.vue)
- 添加页码有效性检查:Math.max(1, Math.min(page, pagination.pages || 1))
- 防止分页越界导致显示空表
影响范围:
- frontend/src/composables/useTableLoader.ts
- frontend/src/views/admin/AccountsView.vue
- frontend/src/views/admin/UsersView.vue
测试:✓ 前端构建测试通过
2026-01-09 17:58:21 +08:00
IanShaw027
ee9b9b3971
fix(fe): 修复表格分页和基础功能问题
...
修复的主要问题:
1. **分页切换失效**(AccountsView.vue)
- 修复 useTableLoader 未解构 handlePageSizeChange 函数
- 添加 @update:pageSize 事件绑定到 Pagination 组件
2. **内存泄漏修复**(多个文件)
- UsersView.vue: 添加 searchTimeout 清理和 abortController.abort()
- ProxiesView.vue: 添加 onUnmounted 钩子清理定时器
- RedeemView.vue: 添加 onUnmounted 钩子清理定时器
3. **分页重置问题**(UsersView.vue)
- toggleBuiltInFilter: 切换筛选器时重置 pagination.page = 1
- toggleAttributeFilter: 切换属性筛选时重置 pagination.page = 1
影响范围:
- frontend/src/views/admin/AccountsView.vue
- frontend/src/views/admin/ProxiesView.vue
- frontend/src/views/admin/RedeemView.vue
- frontend/src/views/admin/UsersView.vue
测试:✓ 前端构建测试通过
2026-01-09 17:38:45 +08:00
LLLLLLiulei
2b528c5f81
feat: auto-pause expired accounts
2026-01-07 16:59:35 +08:00
yangjianbo
5a52cb608c
fix(前端): 修复账号管理页面平台过滤不生效的问题
...
添加 @update:filters 事件监听,使过滤器参数能正确同步到数据请求中。
修复了平台、类型、状态三个过滤器全部失效的问题。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com >
2026-01-06 19:20:05 +08:00
yangjianbo
17ae51c0a0
merge: 合并远程分支并修复代码冲突
...
合并了远程分支 cb72262 的功能更新,同时保留了 ESLint 修复:
**冲突解决详情:**
1. AccountTableFilters.vue
- ✅ 保留 emit 模式修复(避免 vue/no-mutating-props 错误)
- ✅ 添加第三个筛选器 type(账户类型)
- ✅ 新增 antigravity 平台和 inactive 状态选项
2. UserBalanceModal.vue
- ✅ 保留 console.error 错误日志
- ✅ 添加输入验证(金额校验、余额不足检查)
- ✅ 使用 appStore.showError 向用户显示友好错误
3. AccountsView.vue
- ✅ 保留所有 console.error 错误日志(避免 no-empty 错误)
- ✅ 使用新 API:clearRateLimit 和 setSchedulable
4. UsageView.vue
- ✅ 添加 console.error 错误日志
- ✅ 添加图表功能(模型分布、使用趋势)
- ✅ 添加粒度选择(按天/按小时)
- ✅ 保留 XLSX 动态导入优化
**测试结果:**
- ✅ Go tests: PASS
- ✅ golangci-lint: 0 issues
- ✅ ESLint: 0 errors
- ✅ TypeScript: PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-06 12:50:51 +08:00
yangjianbo
4790aced15
fix(前端): 修复 ESLint 代码规范问题
...
- 修复 AccountTableFilters.vue 中的 vue/no-mutating-props 错误,使用 emit 模式替代直接修改 props
- 修复 TypeScript 类型错误,支持 Select 组件的 null 值类型
- 为所有空 catch 块添加错误日志,提升代码可维护性和调试能力
- 涉及文件:AccountTableFilters.vue, UserAllowedGroupsModal.vue, UserApiKeysModal.vue, UserBalanceModal.vue, AccountsView.vue, UsageView.vue, DashboardView.vue, ProfileView.vue
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-06 12:42:06 +08:00
shaw
706af2920f
Merge branch 'fix/account-filters-menu-missing-features'
...
## Summary
- 修复账号管理页面组件拆分时遗漏的功能
- 统一所有内联 SVG 为 Icon 组件
- 修复 ProxySelector 选择"无代理"时发送错误值的问题
## Changes
- AccountTableFilters: 添加 Antigravity 平台选项、类型筛选器、inactive 状态
- AccountActionMenu: 恢复重置状态和清除限速按钮
- AccountsView: 修正 handleClearRateLimit 调用正确的 API
- ProxySelector: 修复选择"无代理"时发送 null 而不是 0
## Conflict Resolution
- ProxySelector.vue: 采用 PR 分支的正确逻辑(发送 null 而不是 0)
这是正确的修复,因为后端使用 *int64 类型,nil 会触发 ClearProxyID()
2026-01-05 21:16:05 +08:00
IanShaw027
b6a4182904
fix(frontend): 修复账号调度按钮使用错误的API端点
...
将 handleToggleSchedulable 从 PUT update() 改为 POST setSchedulable(),
后端 PUT 接口不处理 schedulable 字段,导致切换无效。
2026-01-05 20:48:12 +08:00
LLLLLLiulei
94750fb61f
feat: add account notes field
2026-01-05 14:07:33 +08:00
ianshaw
c52c47e122
fix(frontend): 优化账号筛选工具条布局并修复IP管理表头翻译
...
- 筛选组件保持固定宽度,不再自动拉伸填充
- 左右分布布局,中间自然留空
- 修复 IP 管理页面表头缺失的中文翻译
2026-01-04 21:46:23 -08:00
ianshaw
b05e90e4e4
fix(frontend): 修复账号管理页面组件拆分时遗漏的功能
...
- AccountTableFilters: 添加 Antigravity 平台选项、类型筛选器、inactive 状态
- AccountActionMenu: 恢复重置状态和清除限速按钮,添加 dark mode 样式
- AccountsView: 修正 handleClearRateLimit 调用正确的 API
2026-01-04 19:34:08 -08:00
IanShaw027
eef12cb900
refactor(frontend): 统一管理页面工具条布局和操作列样式
...
## 修复内容
### 1. 统一操作列按钮样式
- 所有操作列按钮统一为"图标+文字"垂直排列样式
- UsersView: 编辑和更多按钮添加文字标签
- 与 AccountsView、GroupsView 等页面保持一致
### 2. 统一顶部工具条布局(6个管理页面)
- 使用 flex + justify-between 布局
- 左侧:模糊搜索框、筛选器(可多行排列)
- 右侧:刷新、创建等操作按钮(靠右对齐)
- 响应式:宽度不够时右侧按钮自动换行到上一行
### 3. 修复的页面
- AccountsView: 合并 actions/filters 到单行工具条
- UsersView: 标准左右分栏,操作列添加文字
- GroupsView: 新增搜索框,左右分栏布局
- ProxiesView: 左右分栏,响应式布局
- SubscriptionsView: 新增用户模糊搜索,左右分栏
- UsageView: 补齐所有筛选项,左右分栏
### 4. 新增功能
- GroupsView: 新增分组名称/描述模糊搜索
- SubscriptionsView: 新增用户模糊搜索功能
- UsageView: 补齐 API Key 搜索筛选
### 5. 国际化
- 新增相关搜索框的 placeholder 文案(中英文)
## 技术细节
- 使用 flex-wrap-reverse 实现响应式换行
- 左侧筛选区使用 flex-wrap 支持多行
- 右侧按钮区使用 ml-auto + justify-end 保持右对齐
- 移动端使用 w-full sm:w-* 响应式宽度
## 验证结果
- ✅ TypeScript 类型检查通过
- ✅ 所有页面布局统一
- ✅ 响应式布局正常工作
2026-01-05 01:00:00 +08:00
IanShaw027
64b52c4383
fix(frontend): 修复前端重构后的样式一致性和功能完整性
...
## 修复内容
### 1. AccountsView 功能恢复
- 恢复3个缺失的模态框组件:
- ReAuthAccountModal.vue - 重新授权功能
- AccountTestModal.vue - 测试连接功能
- AccountStatsModal.vue - 查看统计功能
- 恢复 handleTest/handleViewStats/handleReAuth 调用模态框
- 修复 UpdateAccountRequest 类型定义(添加 schedulable 字段)
### 2. DashboardView 修复
- 恢复 formatBalance 函数(支持千位分隔符显示)
- 为 UserDashboardStats 添加完整 Props 类型定义
- 为 UserDashboardRecentUsage 添加完整 Props 类型定义
- 优化格式化函数到共享 utils/format.ts
### 3. 类型安全增强
- 修复 UserAttributeOption 索引签名兼容性
- 移除未使用的类型导入
- 所有组件 Props 类型完整
## 验证结果
- ✅ TypeScript 类型检查通过(0 errors)
- ✅ vue-tsc 检查通过(0 errors)
- ✅ 所有样式与重构前100%一致
- ✅ 所有功能完整恢复
## 影响范围
- AccountsView: 代码行数从974行优化到189行(提升80.6%可维护性)
- DashboardView: 保持组件化同时恢复所有原有功能
- 深色模式支持完整
- 所有颜色方案和 SVG 图标保持一致
Closes #149
2026-01-05 00:38:23 +08:00
IanShaw027
99308ab4fb
refactor(frontend): comprehensive architectural optimization and base component extraction
...
- Standardized table loading logic with enhanced useTableLoader.
- Unified form submission patterns via new useForm composable.
- Extracted common UI components: SearchInput and StatusBadge.
- Centralized common interface definitions in types/index.ts.
- Achieved TypeScript zero-error status across refactored files.
- Greatly improved code reusability and maintainability.
2026-01-04 22:29:19 +08:00
IanShaw027
e99063e12b
refactor(frontend): comprehensive split of large view files into modular components
...
- Split UsersView.vue into UserCreateModal, UserEditModal, UserApiKeysModal, etc.
- Split UsageView.vue into UsageStatsCards, UsageFilters, UsageTable, etc.
- Split DashboardView.vue into UserDashboardStats, UserDashboardCharts, etc.
- Split AccountsView.vue into AccountTableActions, AccountTableFilters, etc.
- Standardized TypeScript types across new components to resolve implicit 'any' and 'never[]' errors.
- Improved overall frontend maintainability and code clarity.
2026-01-04 22:17:27 +08:00