1. 31 Dec, 2025 3 commits
  2. 30 Dec, 2025 1 commit
  3. 28 Dec, 2025 2 commits
    • IanShaw027's avatar
      feat(全栈): 实现简易模式核心功能 · ecfad788
      IanShaw027 authored
      **功能概述**:
      实现简易模式(Simple Mode),为个人用户和小团队提供简化的使用体验,隐藏复杂的分组、订阅、配额等概念。
      
      **后端改动**:
      1. 配置系统
         - 新增 run_mode 配置项(standard/simple)
         - 支持环境变量 RUN_MODE
         - 默认值为 standard
      
      2. 数据库初始化
         - 自动创建3个默认分组:anthropic-default、openai-default、gemini-default
         - 默认分组配置:无并发限制、active状态、非独占
         - 幂等性保证:重复启动不会重复创建
      
      3. 账号管理
         - 创建账号时自动绑定对应平台的默认分组
         - 如果未指定分组,自动查找并绑定默认分组
      
      **前端改动**:
      1. 状态管理
         - authStore 新增 isSimpleMode 计算属性
         - 从后端API获取并同步运行模式
      
      2. UI隐藏
         - 侧边栏:隐藏分组管理、订阅管理、兑换码菜单
         - 账号管理页面:隐藏分组列
         - 创建/编辑账号对话框:隐藏分组选择器
      
      3. 路由守卫
         - 限制访问分组、订阅、兑换码相关页面
         - 访问受限页面时自动重定向到仪表板
      
      **配置示例**:
      ```yaml
      run_mode: simple
      
      run_mode: standard
      ```
      
      **影响范围**:
      - 后端:配置、数据库迁移、账号服务
      - 前端:认证状态、路由、UI组件
      - 部署:配置文件示例
      
      **兼容性**:
      - 简易模式和标准模式可无缝切换
      - 不需要数据迁移
      - 现有数据不受影响
      ecfad788
    • noreply's avatar
      feat: Schedule batch update for account last_used_at · cbfce49a
      noreply authored
      Implement deferred batch update mechanism to reduce database load:
      
      - Add DeferredService for batching account last_used_at updates
      - Add TimingWheelService for efficient recurring task scheduling
      - Integrate with GatewayService and OpenAIGatewayService
      - Implement BatchUpdateLastUsed repository method using CASE...WHEN SQL
      - Fix golangci-lint error: Replace interface{} with any
      
      Benefits:
      - Reduces database writes by batching updates (10-second intervals)
      - Improves request throughput by deferring non-critical updates
      - Maintains accurate account usage tracking for scheduling
      cbfce49a
  4. 27 Dec, 2025 1 commit
  5. 26 Dec, 2025 3 commits
  6. 25 Dec, 2025 2 commits
    • Forest's avatar
      refactor: 删除 ports 目录 · f51ad2e1
      Forest authored
      f51ad2e1
    • hi_yueban's avatar
      fix: 修复 OpenAI 账号 5h/7d 使用限制显示错误的问题 (#30) · f57f12c6
      hi_yueban authored
      * fix: 修复 OpenAI 账号 5h/7d 使用限制显示错误的问题
      
      问题描述:
      - 账号管理页面中,OpenAI OAuth 账号的 5h 列显示 7 天的剩余时间
      - 7d 列却显示几小时的剩余时间
      - 根本原因: OpenAI 响应头中 primary/secondary 的实际含义与代码假设相反
      
      修复方案:
      1. 后端归一化 (openai_gateway_service.go):
         - 根据 window_minutes 动态判断哪个是 5h/7d 限制
         - 新增规范字段 codex_5h_* 和 codex_7d_*
         - 保留旧字段以兼容性
      
      2. 前端适配 (AccountUsageCell.vue):
         - 优先使用新的规范字段
         - Fallback 到旧字段时基于 window_minutes 动态判断
         - 更新 computed 属性命名
      
      3. 类型定义更新 (types/index.ts):
         - 添加新的规范字段定义
         - 更新注释说明实际语义由 window_minutes 决定
      
      🤖
      
       Generated with Claude Code and Codex collaboration
      Co-Authored-By: default avatarClaude Sonnet 4.5 <noreply@anthropic.com>
      Co-Authored-By: default avatarOpenAI Codex <noreply@openai.com>
      
      * fix: 改进窗口判断逻辑,修复两个窗口都小于阈值时的bug
      
      问题:
      当两个窗口都小于360分钟时(如 primary=180分钟,secondary=300分钟),
      之前的逻辑会导致:
      - primary5h = true, secondary5h = true
      - 5h 字段会使用 primary(错误)
      - 7d 字段没有数据(bug)
      
      修复方案:
      改用比较策略:
      1. 当两个窗口都存在时:较小的分配给5h,较大的分配给7d
      2. 当只有一个窗口时:根据大小(<=360分钟)判断是5h还是7d
      3. 确保数据不会丢失,逻辑更健壮
      
      示例:
      - Primary: 180分钟, Secondary: 300分钟
        → 5h 使用 Primary(180分钟), 7d 使用 Secondary(300分钟) ✓
      
      🤖
      
       Generated with Claude Code
      Co-Authored-By: default avatarClaude Sonnet 4.5 <noreply@anthropic.com>
      
      * fix: 修正窗口大小判断逻辑 - 不能用剩余时间判断窗口类型
      
      **严重bug修复:**
      之前的 fallback 逻辑错误地使用 reset_after_seconds 来判断窗口大小。
      
      问题示例:
      - 周限制(7d)剩余 2h → reset_after_seconds = 7200秒
      - 5h限制 剩余 4h → reset_after_seconds = 14400秒
      - 错误逻辑:7200/60 < 14400/60,把周限制当成5h 
      
      根本问题:
      - window_minutes = 窗口的总大小(300 or 10080)
      - reset_after_seconds = 距离重置的剩余时间(变化的)
      - 不能用剩余时间来判断窗口类型!
      
      修复方案:
      1. **只使用 window_minutes** 来判断窗口大小
      2. 移除错误的 reset_after_seconds fallback
      3. 如果 window_minutes 都不存在,使用传统假设
      4. 添加详细注释说明这个陷阱
      
      🤖
      
       Generated with Claude Code
      Co-Authored-By: default avatarClaude Sonnet 4.5 <noreply@anthropic.com>
      
      * fix: 修复 lint 问题 - 改进 fallback 逻辑的变量赋值
      
      问题:
      第882-883行的简单布尔赋值可能触发 ineffassign 或 staticcheck 警告:
        use5hFromSecondary = snapshot.SecondaryUsedPercent != nil
        use7dFromPrimary = snapshot.PrimaryUsedPercent != nil
      
      修复:
      改用明确的 if 语句检查任意字段是否存在,更符合代码意图:
      - 如果 secondary 的任意字段存在,将其视为 5h
      - 如果 primary 的任意字段存在,将其视为 7d
      
      这样逻辑更清晰,也避免了 lint 警告。
      
      ---------
      Co-authored-by: default avatarClaude Sonnet 4.5 <noreply@anthropic.com>
      Co-authored-by: default avatarOpenAI Codex <noreply@openai.com>
      f57f12c6
  7. 24 Dec, 2025 1 commit
  8. 23 Dec, 2025 3 commits
    • shaw's avatar
      feat: OpenAI OAuth账号显示Codex使用量 · f25ac3af
      shaw authored
      从响应头提取x-codex-*使用量信息并保存到账号Extra字段,
      前端账号列表展示5h/7d窗口的使用进度条。
      f25ac3af
    • shaw's avatar
      fix: 修复golangci-lint检查问题 · eb55947e
      shaw authored
      - 移除OpenAIGatewayHandler中未使用的userService字段
      - 将账号类型判断的if-else链改为switch语句
      eb55947e
    • shaw's avatar
      feat: 平台图标与计费修复 · fda75327
      shaw authored
      - fix(billing): 修复 OpenAI 兼容 API 缓存 token 重复计费问题
      - fix(auth): 隐藏数据库错误详情,返回通用服务不可用错误
      - feat(ui): 新增 PlatformIcon 组件,GroupBadge 支持平台颜色区分
      - feat(ui): 账号管理新增重置状态按钮,重授权后自动清除错误
      - feat(ui): 分组管理新增计费类型列,显示订阅限额信息
      - ui: 首页 GPT 状态改为已支持
      fda75327
  9. 22 Dec, 2025 1 commit