1. 16 Jan, 2026 7 commits
  2. 13 Jan, 2026 3 commits
    • song's avatar
      refactor: 提取 getOrCreateGeminiParts 减少重复代码 · 9a22d1a6
      song authored
      将两个 merge 函数中重复的 Gemini 响应结构访问逻辑提取为公共函数。
      9a22d1a6
    • song's avatar
      fix: 修复 Antigravity 非流式响应文本丢失问题 · c9d21d53
      song authored
      Gemini 流式响应是增量的,需要累积所有 chunk 的文本内容。
      原代码只保留最后一个有 parts 的 chunk,导致实际文本被空
      text + thoughtSignature 的最终 chunk 覆盖。
      
      添加 collectedTextParts 收集所有文本片段,返回前合并。
      c9d21d53
    • song's avatar
      fix: 修复 Antigravity 图片生成响应丢失问题 · e1015c27
      song authored
      流式转非流式时,图片数据在中间 chunk 返回,最后一个 chunk 只有
      finishReason,导致只保留最后 chunk 时图片丢失。
      
      添加 collectedImageParts 收集所有图片 parts,并在返回前合并。
      e1015c27
  3. 09 Jan, 2026 13 commits
    • song's avatar
      chore: 提升 SSE 单行上限到 40MB · c2a6ca8d
      song authored
      c2a6ca8d
    • song's avatar
      chore: 调整 SSE 单行上限到 25MB · 7b1cf2c4
      song authored
      7b1cf2c4
    • IanShaw027's avatar
      fix(admin): 代码审查修复 - 输入验证和测试完善 · 7c3d5cad
      IanShaw027 authored
      根据 Codex 代码审查报告,修复所有 P0 和 P1 优先级问题。
      
      ## P0 紧急修复
      
      ### 1. 修复集成测试编译错误
      - 更新 group_repo_integration_test.go 中所有 ListWithFilters 调用
      - 添加缺失的 search 参数(传入空字符串)
      - 修复 4 处旧签名调用,避免 CI 编译失败
      
      ### 2. 添加统一的 search 参数输入验证
      为所有 admin handler 添加一致的输入验证逻辑:
      - group_handler.go: 添加 TrimSpace + 长度限制
      - proxy_handler.go: 添加 TrimSpace + 长度限制
      - redeem_handler.go: 添加 TrimSpace + 长度限制
      - user_handler.go: 添加 TrimSpace + 长度限制
      
      验证规则:
      - TrimSpace() 去除首尾空格
      - 最大长度 100 字符(防止 DoS 攻击)
      - 超长输入自动截断
      
      ## P1 改进
      
      ### 3. 补充 search 功能的单元测试
      新增 admin_service_group_test.go 中的测试:
      - TestAdminService_ListGroups_WithSearch
        - search 参数正常传递到 repository 层
        - search 为空字符串时的行为
        - search 与其他过滤条件组合使用
      
      新增 admin_service_search_test.go 文件:
      - 为其他 admin API 添加 search 测试覆盖
      - 统一的测试模式和断言
      
      ### 4. 补充 search 功能的集成测试
      新增 group_repo_integration_test.go 测试场景:
      - TestListWithFilters_Search
        - 搜索 name 字段匹配
        - 搜索 description 字段匹配
        - 搜索不存在内容(返回空)
        - 大小写不敏感测试
        - 特殊字符转义测试(%、_)
        - 与其他过滤条件组合
      
      ## 测试结果
      
      -  编译检查通过
      -  单元测试全部通过 (3/3)
      -  集成测试编译通过
      -  所有 service 测试通过
      
      ## 影响范围
      
      修改文件: 8 个
      代码变更: +234 行 / -8 行
      
      ## 相关 Issue
      
      解决代码审查中的安全性和稳定性问题:
      - 防止 DoS 攻击(超长搜索字符串)
      - 修复测试编译错误(CI 阻塞问题)
      - 提升测试覆盖率
      7c3d5cad
    • shaw's avatar
      f060db0b
    • IanShaw027's avatar
      feat(admin): 添加账号批量调度开关功能 · 5e936fbf
      IanShaw027 authored
      - 后端:支持批量更新账号的 schedulable 字段
        - 在 BulkUpdateAccountsRequest 中添加 schedulable 参数
        - 在 AccountBulkUpdate 中添加 schedulable 字段支持
        - 更新 repository 层批量更新 SQL 逻辑
      - 前端:在账号管理页面添加批量调度控制
        - 新增"批量启用调度"和"批量停止调度"按钮
        - 添加 handleBulkToggleSchedulable 处理函数
        - 显示具体的成功提示信息(包含操作账号数量)
      - 国际化:添加批量调度相关中英文翻译
      - 优化:添加 search 参数标准化和验证(account_handler)
      5e936fbf
    • IanShaw027's avatar
      fix(admin): 修复表格批量操作和搜索功能问题 · 38202322
      IanShaw027 authored
      1. 恢复账号管理批量操作栏缺失的功能按钮
         - 添加"本页全选"按钮支持批量选择当前页所有账号
         - 添加"清除已选"按钮快速清空已选账号列表
         - 在重构拆分组件时遗漏,现已恢复
      
      2. 修复分组管理搜索功能仅搜索当前页的问题
         - 前端:移除本地过滤逻辑,改用后端搜索
         - 后端:添加 search 参数支持,搜索名称和描述字段
         - 支持不区分大小写的模糊匹配
         - 统一所有管理页面的搜索体验
      38202322
    • shaw's avatar
      1a1e23fc
    • admin's avatar
      refactor(auth): 将 Linux DO OAuth 配置迁移到系统设置 · d1c2a61d
      admin authored
      - 将 LinuxDo Connect 配置从环境变量迁移到数据库持久化
      - 在管理后台系统设置中添加 LinuxDo OAuth 配置项
      - 简化部署流程,无需修改 docker-compose.override.yml
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      d1c2a61d
    • admin's avatar
      feat(auth): 添加 Linux DO Connect OAuth 登录支持 · 152d0cde
      admin authored
      - 新增 Linux DO OAuth 配置项和环境变量支持
      - 实现 OAuth 授权流程和回调处理
      - 前端添加 Linux DO 登录按钮和回调页面
      - 支持通过 Linux DO 账号注册/登录
      - 添加相关国际化文本
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      152d0cde
    • song's avatar
      feat: antigravity 配额域限流 · da1f3d61
      song authored
      da1f3d61
    • shaw's avatar
      43f104bd
    • 程序猿MT's avatar
      fix(auth): 修复 RefreshToken 使用过期 token 时的 nil pointer panic (#214) · 799b0106
      程序猿MT authored
      
      
      * fix(auth): 修复 RefreshToken 使用过期 token 时的 nil pointer panic
      
      问题分析:
      - RefreshToken 允许过期 token 继续流程(用于无感刷新)
      - 但 ValidateToken 在 token 过期时返回 nil claims
      - 导致后续访问 claims.UserID 时触发 panic
      
      修复方案:
      - 修改 ValidateToken,在检测到 ErrTokenExpired 时仍然返回 claims
      - jwt-go 在解析时即使遇到过期错误,token.Claims 仍会被填充
      - 这样 RefreshToken 可以正常获取用户信息并生成新 token
      
      新增测试:
      - TestAuthService_ValidateToken_ExpiredReturnsClaimsWithError
      - TestAuthService_RefreshToken_ExpiredTokenNoPanic
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      
      * fix(auth): 修复邮件验证服务未配置时可绕过验证的安全漏洞
      
      当邮件验证开启但 emailService 未配置时,原逻辑允许用户绕过验证直接注册。
      现在会返回 ErrServiceUnavailable 拒绝注册,确保配置错误不会导致安全问题。
      
      - 在验证码检查前先检查 emailService 是否配置
      - 添加日志记录帮助发现配置问题
      - 新增单元测试覆盖该场景
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      
      ---------
      Co-authored-by: default avataryangjianbo <yangjianbo@leagsoft.com>
      Co-authored-by: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      799b0106
    • shaw's avatar
  4. 08 Jan, 2026 9 commits
    • cyhhao's avatar
      feat(openai): add AI SDK content format compatibility for OAuth accounts · 5b8d4fb0
      cyhhao authored
      - Add normalizeInputForCodexAPI function to convert AI SDK multi-part
        content format to simplified format expected by ChatGPT Codex API
      - AI SDK sends: {"content": [{"type": "input_text", "text": "..."}]}
      - Codex API expects: {"content": "..."}
      - Only applies to OAuth accounts (ChatGPT internal API)
      - API Key accounts remain unchanged (OpenAI Platform API supports both)
      5b8d4fb0
    • IanShaw's avatar
      fix(gemini): Google One 强制使用内置 OAuth client + 自动获取 project_id + UI 优化 (#212) · afcfbb45
      IanShaw authored
      * fix(gemini): Google One 强制使用内置 OAuth client + 自动获取 project_id + UI 优化
      
      ## 后端改动
      
      ### 1. Google One 强制使用内置 Gemini CLI OAuth Client
      **问题**:
      - Google One 之前允许使用自定义 OAuth client,导致认证流程不稳定
      - 与 Code Assist 的行为不一致
      
      **解决方案**:
      - 修改 `gemini_oauth_service.go`: Google One 现在与 Code Assist 一样强制使用内置 client (L122-135)
      - 更新 `gemini_oauth_client.go`: ExchangeCode 和 RefreshToken 方法支持强制内置 client (L31-44, L77-86)
      - 简化 `geminicli/oauth.go`: Google One scope 选择逻辑 (L187-190)
      - 标记 `geminicli/constants.go`: DefaultGoogleOneScopes 为 DEPRECATED (L30-33)
      - 更新测试用例以反映新行为
      
      **OAuth 类型对比**:
      | OAuth类型 | Client来源 | Scopes | Redirect URI |
      |-----------|-----------|--------|-----------------|
      | code_assist | 内置 Gemini CLI | DefaultCodeAssistScopes | https://codeassist.google.com/authcode |
      | google_one | 内置 Gemini CLI (新) | DefaultCodeAssistScopes | https://codeassist.google.com/authcode |
      | ai_studio | 必须自定义 | DefaultAIStudioScopes | http://localhost:1455/auth/callback |
      
      ### 2. Google One 自动获取 project_id
      **问题**:
      - Google One 个人账号测试模型时返回 403/404 错误
      - 原因:cloudaicompanion API 需要 project_id,但个人账号无需手动创建 GCP 项目
      
      **解决方案**:
      - 修改 `gemini_oauth_service.go`: OAuth 流程中自动调用 fetchProjectID
      - Google 通过 LoadCodeAssist API 自动分配 project_id
      - 与 Gemini CLI 行为保持一致
      - 后端根据 project_id 自动选择正确的 API 端点
      
      **影响**:
      - Google One 账号现在可以正常使用(需要重新授权)
      - Code Assist 和 AI Studio 账号不受影响
      
      ### 3. 修复 Gemini 测试账号无内容输出问题
      **问题**:
      - 测试 Gemini 账号时只显示"测试成功",没有显示 AI 响应内容
      - 原因:processGeminiStream 在检查到 finishReason 时立即返回,跳过了内容提取
      
      **解决方案**:
      - 修改 `account_test_service.go`: 调整逻辑顺序,先提取内容再检查是否完成
      - 确保最后一个 chunk 的内容也能被正确显示
      
      **影响**:
      - 所有 Gemini 账号类型(API Key、OAuth)的测试现在都会显示完整响应内容
      - 用户可以看到流式输出效果
      
      ## 前端改动
      
      ### 1. 修复图标宽度压缩问题
      **问题**:
      - 账户类型选择按钮中的图标在某些情况下会被压缩变形
      
      **解决方案**:
      - 修改 `CreateAccountModal.vue`: 为所有平台图标容器添加 `shrink-0` 类
      - 确保 Anthropic、OpenAI、Gemini、Antigravity 图标保持固定 8×8 尺寸 (32px × 32px)
      
      ### 2. 优化重新授权界面
      **问题**:
      - 重新授权时显示三个可点击的授权类型选择按钮,可能导致用户误切换到不兼容的授权方式
      
      **解决方案**:
      - 修改 `ReAuthAccountModal.vue` (admin 和普通用户版本):
        - 将可点击的授权类型选择按钮改为只读信息展示框
        - 根据账号的 `credentials.oauth_type` 动态显示对应图标和文本
        - 删除 `geminiAIStudioOAuthEnabled` 状态和 `handleSelectGeminiOAuthType` 方法
        - 防止用户误操作
      
      ## 测试验证
      -  所有后端单元测试通过
      -  OAuth client 选择逻辑正确
      -  Google One 和 Code Assist 行为一致
      -  测试账号显示完整响应内容
      -  UI 图标显示正常
      -  重新授权界面只读展示正确
      
      * fix(lint): 修复 golangci-lint 错误信息格式问题
      
      - 将错误信息改为小写开头以符合 Go 代码规范
      - 修复 ST1005: error strings should not be capitalized
      afcfbb45
    • Edric Li's avatar
      fix: update mock interfaces and fix gofmt issues for CI · b7a29a4b
      Edric Li authored
      - Update mockGatewayCacheForPlatform and mockGatewayCacheForGemini
        to match new GatewayCache interface with groupID parameter
      - Fix gofmt formatting in group_handler.go and admin_service.go
      b7a29a4b
    • Edric Li's avatar
      feat(groups): add Claude Code client restriction and session isolation · a4210588
      Edric Li authored
      - Add claude_code_only field to restrict groups to Claude Code clients only
      - Add fallback_group_id for non-Claude Code requests to use alternate group
      - Implement ClaudeCodeValidator for User-Agent detection
      - Add group-level session binding isolation (groupID in Redis key)
      - Prevent cross-group sticky session pollution
      - Update frontend with Claude Code restriction controls
      a4210588
    • Edric Li's avatar
      test: fix unit tests for user_agent and proxy repo interface · 958ffe7a
      Edric Li authored
      - Add user_agent field to API contract test expectation
      - Add ListWithFiltersAndAccountCount stub to proxyRepoStub
      958ffe7a
    • Edric Li's avatar
      feat(proxies): add account count column to proxy list · eb198e59
      Edric Li authored
      Display the number of accounts bound to each proxy in the admin proxy
      management page, similar to the groups list view.
      eb198e59
    • shaw's avatar
      b015a3bd
    • shaw's avatar
      fix(antigravity): 修复请求频繁429的问题 · 6e8188ed
      shaw authored
      6e8188ed
    • shaw's avatar
      fix(billing): 修复客户端取消请求时计费丢失问题 · db6f53e2
      shaw authored
      检测 context.Canceled 作为客户端断开信号,返回已收集的 usage 而非错误
      db6f53e2
  5. 07 Jan, 2026 4 commits
    • Edric Li's avatar
      feat(usage-log): 增加请求 User-Agent 记录 · 1ada6cf7
      Edric Li authored
      在使用记录中添加 user_agent 字段,用于记录 API 请求的 User-Agent 头信息,
      便于分析客户端类型和调试。
      
      变更内容:
      - 新增数据库迁移 028_add_usage_logs_user_agent.sql
      - 更新 UsageLog 模型和 Ent Schema 添加 user_agent 字段
      - 更新 Repository 层的 Create 和 scanUsageLog 方法
      - 更新 RecordUsageInput 结构体支持传入 UserAgent
      - 更新 Claude/OpenAI/Gemini 三个网关 Handler 传递 UserAgent
      
      🤖 Generated with [Claude Code](https://claude.com/claude-code
      
      )
      Co-Authored-By: default avatarClaude Opus 4.5 <noreply@anthropic.com>
      1ada6cf7
    • LLLLLLiulei's avatar
      feat: auto-pause expired accounts · 2b528c5f
      LLLLLLiulei authored
      2b528c5f
    • shaw's avatar
      fix(gateway): 修复账号跨分组调度问题 · d99a3ef1
      shaw authored
      问题:账号可能被调度到未分配的分组(如 simon 账号被调度到 claude_default)
      
      根因:
      - 强制平台模式下分组查询失败时回退到全平台查询
      - listSchedulableAccounts 中分组为空时回退到无分组查询
      - 粘性会话只检查平台匹配,未校验账号分组归属
      
      修复:
      - 移除强制平台模式的回退逻辑,分组内无账号时返回错误
      - 移除 listSchedulableAccounts 的回退逻辑
      - 新增 isAccountInGroup 方法用于分组校验
      - 在三处粘性会话检查中增加分组归属验证
      d99a3ef1
    • shaw's avatar
      fix(gateway): 修复 cache_control 块超限问题并优化 Claude Code 检测 · 6dcd9946
      shaw authored
      问题:
      - OAuth/SetupToken 账号注入 system prompt 后可能导致 cache_control
        块超过 Anthropic API 的 4 个限制
      - Claude Code 检测使用精确匹配,无法识别 Agent SDK 等变体
      
      修复:
      - 新增 enforceCacheControlLimit 函数,强制执行 4 个块限制
      - 优先从 messages 移除,再从 system 尾部移除(保护注入的 prompt)
      - 改用前缀匹配检测 Claude Code 系统提示词,支持多种变体:
        - 标准版、Agent SDK 版、Explore Agent 版、Compact 版
      6dcd9946
  6. 06 Jan, 2026 3 commits
    • shaw's avatar
      feat(admin/usage): 优化管理员用量页面功能和体验 · 015974a2
      shaw authored
      后端改进:
      - 新增 GetStatsWithFilters 方法支持完整筛选条件
      - Stats 端点支持 account_id, group_id, model, stream, billing_type 参数
      - 统一使用 filters 结构体,移除冗余的分支逻辑
      
      前端改进:
      - 统计卡片添加"所选范围内"文字提示
      - 优化总消费显示格式,清晰展示实际费用和标准计费
      - Token 和费用列添加问号图标 tooltip 显示详细信息
      - API Key 搜索框体验优化:点击即显示下拉选项
      - 选择用户后自动加载该用户的所有 API Key
      015974a2
    • song's avatar
    • yangjianbo's avatar
      fix(安全): 修复依赖漏洞并强化安全扫描 · 3f0017d1
      yangjianbo authored
      主要改动:
      - 固定 Go 1.25.5 与 CI 校验并更新扫描流程
      - 升级 quic-go、x/crypto、req 等依赖并通过 govulncheck
      - 强化 JWT 校验、TLS 配置与 xlsx 动态加载
      - 新增审计豁免清单与校验脚本
      3f0017d1
  7. 05 Jan, 2026 1 commit
    • shaw's avatar
      fix(admin): 修复零值字段无法保存的问题 · 4d078a88
      shaw authored
      - 用户允许分组:前端发送空数组而非 null 表示"允许全部"
      - 账户代理:前端发送 0 而非 null 表示"无代理"
      - 后端 UpdateAccount/BulkUpdate 正确处理 ProxyID=0 为清除代理
      4d078a88