1. 11 Jan, 2026 4 commits
    • IanShaw027's avatar
      feat(ops): 添加上游错误事件数据库表 · c2962752
      IanShaw027 authored
      - 新建ops_upstream_error_events表存储上游服务错误详情
      - 记录上游错误的请求ID、平台、模型、状态码等信息
      - 支持索引优化查询性能(request_id, platform, status_code, created_at)
      c2962752
    • IanShaw027's avatar
      feat(ops): 添加QPS脉搏线图并优化指标布局 · 89a725a4
      IanShaw027 authored
      - 添加实时QPS/TPS历史数据追踪(最近60个数据点)
      - 在平均QPS/TPS上方添加SVG脉搏线图(sparkline)
      - 将延迟和TTFT卡片的指标布局从2列改为3列
      - 恢复Max指标显示(P95/P90/P50/Avg/Max)
      89a725a4
    • IanShaw027's avatar
      fix: 临时保存编译错误修复 · fc4ea659
      IanShaw027 authored
      - 添加 LinuxDo 和 Update 配置(从 main 分支缺失)
      - 添加 LinuxDoConnectSyntheticEmailDomain 常量
      - 添加 IsClaudeCodeClient context key
      - 添加 GetLinuxDoConnectOAuthConfig 方法
      - 修复 BindStickySession 调用签名
      - 修复前端 i18n 重复属性
      - 重新生成 wire 依赖注入代码
      
      这个提交准备被合并替换,先保存以防丢失。
      fc4ea659
    • shaw's avatar
      chore: remove accidentally committed test binary · 56fc2764
      shaw authored
      56fc2764
  2. 10 Jan, 2026 14 commits
  3. 09 Jan, 2026 22 commits
    • yangjianbo's avatar
      fix(分组): 防止降级环并校验上下文分组 · 2597fe78
      yangjianbo authored
      - 增加降级链路环检测并拦截配置
      
      - 仅复用合法分组上下文并必要时回退查询
      
      - 标注 GetByIDLite 轻量语义并补充测试
      2597fe78
    • IanShaw027's avatar
      feat(运维监控): 重构仪表板布局和增强数据展示 · c48dc097
      IanShaw027 authored
      主要改动:
      - 重构仪表板为左右布局(5:7比例)
      - 左侧:健康评分 + 实时信息(当前/峰值/平均 QPS/TPS)
      - 右侧:6个卡片展示详细指标(3列x2行)
        - 总请求:请求数、Token数、平均QPS/TPS、平均延迟/TTFT
        - SLA:百分比、异常数、进度条
        - 延迟:P99/P95/P90/P50/Avg/Max(带颜色编码)
        - TTFT:P99/P95/P90/P50/Avg/Max(带颜色编码)
        - 请求错误:错误率、错误数、业务限制数
        - 上游错误:错误率、错误数(排除429/529)、429/529数
      - 添加延迟/TTFT颜色编码(<500ms绿色,<1s黄色,<2s橙色,≥2s红色)
      - 添加实时窗口选择器(1min/5min/30min/1h)
      - 优化时间段选择器标签("近5分钟"等)
      - 完善中英文i18n翻译
      - 数据库:添加Redis连接池字段(redis_conn_total, redis_conn_idle)
      c48dc097
    • IanShaw027's avatar
      feat(运维监控): 增强监控功能和健康评分系统 · 585257d3
      IanShaw027 authored
      后端改进:
      - 新增健康评分计算服务(ops_health_score.go)
      - 添加分布式锁支持(ops_advisory_lock.go)
      - 优化指标采集和聚合逻辑
      - 新增运维指标采集间隔配置(60-3600秒)
      - 移除未使用的WebSocket查询token认证中间件
      - 改进清理服务和告警评估逻辑
      
      前端改进:
      - 简化OpsDashboard组件结构
      - 完善国际化文本(中英文)
      - 新增运维监控相关API类型定义
      - 添加运维指标采集间隔设置界面
      - 优化错误详情模态框
      
      测试:
      - 添加健康评分单元测试
      - 更新API契约测试
      585257d3
    • yangjianbo's avatar
      perf(网关): 复用分组上下文减少热路径查询 · 67554324
      yangjianbo authored
      新增 GetByIDLite 并在网关与 Gemini 选择流程复用上下文 group,避免 COUNT 触发
      更新 API key 中间件注入 group 上下文,减少重复查库
      补充 gateway/gemini 中间件与仓库层回归测试
      
      测试: make test
      67554324
    • Song Siyu's avatar
      feat: antigravity 配额域限流 + SSE 上限 (#222) · 7d1fe818
      Song Siyu authored
      * fix: 添加 gemini-3-flash 前缀映射支持 gemini-3-flash-preview
      
      * feat(antigravity): 增强请求参数和注入 Antigravity 身份 system prompt
      
      * feat: antigravity 配额域限流
      
      * chore: 调整 SSE 单行上限到 25MB
      
      * chore: 提升 SSE 单行上限到 40MB
      7d1fe818
    • Edric.Li's avatar
      feat(api-key): 添加 IP 白名单/黑名单限制功能 (#221) · 0a4641c2
      Edric.Li authored
      * feat(api-key): add IP whitelist/blacklist restriction and usage log IP tracking
      
      - Add IP restriction feature for API keys (whitelist/blacklist with CIDR support)
      - Add IP address logging to usage logs (admin-only visibility)
      - Remove billing_type column from usage logs UI (redundant)
      - Use generic "Access denied" error message for security
      
      Backend:
      - New ip package with IP/CIDR validation and matching utilities
      - Database migrations for ip_whitelist, ip_blacklist (api_keys) and ip_address (usage_logs)
      - Middleware IP restriction check after API key validation
      - Input validation for IP/CIDR patterns on create/update
      
      Frontend:
      - API key form with enable toggle for IP restriction
      - Shield icon indicator in table for keys with IP restriction
      - Removed billing_type filter and column from usage views
      
      * fix: update API contract tests for ip_whitelist/ip_blacklist fields
      
      Add ip_whitelist and ip_blacklist fields to expected JSON responses
      in API contract tests to match the new API key schema.
      0a4641c2
    • Edric Li's avatar
      fix: update API contract tests for ip_whitelist/ip_blacklist fields · e83f644c
      Edric Li authored
      Add ip_whitelist and ip_blacklist fields to expected JSON responses
      in API contract tests to match the new API key schema.
      e83f644c
    • Edric Li's avatar
      feat(api-key): add IP whitelist/blacklist restriction and usage log IP tracking · 90798f14
      Edric Li authored
      - Add IP restriction feature for API keys (whitelist/blacklist with CIDR support)
      - Add IP address logging to usage logs (admin-only visibility)
      - Remove billing_type column from usage logs UI (redundant)
      - Use generic "Access denied" error message for security
      
      Backend:
      - New ip package with IP/CIDR validation and matching utilities
      - Database migrations for ip_whitelist, ip_blacklist (api_keys) and ip_address (usage_logs)
      - Middleware IP restriction check after API key validation
      - Input validation for IP/CIDR patterns on create/update
      
      Frontend:
      - API key form with enable toggle for IP restriction
      - Shield icon indicator in table for keys with IP restriction
      - Removed billing_type filter and column from usage views
      90798f14
    • IanShaw027's avatar
      test(后端): 更新 API 契约测试支持 ops 监控端点 · e8464580
      IanShaw027 authored
      - 更新 api_contract_test.go 包含 ops 相关端点测试
      e8464580
    • IanShaw027's avatar
      feat(设置): 集成运维监控配置到系统设置 · 2d123a11
      IanShaw027 authored
      - 扩展 setting_handler 支持 ops 配置管理
      - 扩展 setting_service 支持 ops 配置持久化
      - 更新 settings_view 包含 ops 配置视图
      2d123a11
    • IanShaw027's avatar
      feat(网关): 集成运维监控到 API 网关处理器 · fcdf839b
      IanShaw027 authored
      - 在 gateway_handler 中添加请求监控和错误追踪
      - 在 openai_gateway_handler 中集成 ops 指标采集
      - 在 gemini_v1beta_handler 中集成 ops 指标采集
      - 更新 handler 基类支持 ops 错误日志记录
      fcdf839b
    • IanShaw027's avatar
      feat(依赖注入): 集成运维监控依赖注入配置 · d55dd56f
      IanShaw027 authored
      - 更新 wire.go 添加 ops 服务依赖注入提供者
      - 重新生成 wire_gen.go 包含完整的依赖注入图
      d55dd56f
    • IanShaw027's avatar
      feat(路由): 集成运维监控路由到服务器 · e0d12b46
      IanShaw027 authored
      - 更新路由器注册 ops 监控路由
      - 添加 ops 管理路由(dashboard, alerts, realtime, settings, ws)
      - 更新 gateway 路由支持请求追踪
      - 集成 ops 服务到 HTTP 服务器
      e0d12b46
    • IanShaw027's avatar
      feat(handler): 实现运维监控 API 处理器和中间件 · f3ed95d4
      IanShaw027 authored
      - 新增 ops 错误日志记录器(ops_error_logger.go)
      - 新增 ops 主处理器(ops_handler.go)
      - 新增告警管理处理器(ops_alerts_handler.go)
      - 新增仪表板处理器(ops_dashboard_handler.go)
      - 新增实时监控处理器(ops_realtime_handler.go)
      - 新增配置管理处理器(ops_settings_handler.go)
      - 新增 WebSocket 处理器(ops_ws_handler.go)
      - 扩展设置 DTO 支持 ops 配置
      - 新增客户端请求 ID 中间件(client_request_id.go)
      - 新增 WebSocket 查询令牌认证中间件(ws_query_token_auth.go)
      - 更新管理员认证中间件支持 ops 路由
      - 注册 handler 依赖注入
      f3ed95d4
    • IanShaw027's avatar
      feat(service): 实现运维监控业务逻辑层 · 5baa8b56
      IanShaw027 authored
      - 新增 ops 主服务(ops_service.go)和端口定义(ops_port.go)
      - 实现账号可用性检查服务(ops_account_availability.go)
      - 实现数据聚合服务(ops_aggregation_service.go)
      - 实现告警评估服务(ops_alert_evaluator_service.go)
      - 实现告警管理服务(ops_alerts.go)
      - 实现数据清理服务(ops_cleanup_service.go)
      - 实现并发控制服务(ops_concurrency.go)
      - 实现仪表板服务(ops_dashboard.go)
      - 实现错误处理服务(ops_errors.go)
      - 实现直方图服务(ops_histograms.go)
      - 实现指标采集服务(ops_metrics_collector.go)
      - 实现查询模式服务(ops_query_mode.go)
      - 实现实时监控服务(ops_realtime.go)
      - 实现请求详情服务(ops_request_details.go)
      - 实现重试机制服务(ops_retry.go)
      - 实现配置管理服务(ops_settings.go)
      - 实现趋势分析服务(ops_trends.go)
      - 实现窗口统计服务(ops_window_stats.go)
      - 添加 ops 相关领域常量
      - 注册 service 依赖注入
      5baa8b56
    • IanShaw027's avatar
      feat(repository): 实现运维监控数据访问层 · bb530327
      IanShaw027 authored
      - 新增 ops 主仓库(ops_repo.go)
      - 实现告警数据访问(ops_repo_alerts.go)
      - 实现仪表板数据访问(ops_repo_dashboard.go)
      - 实现直方图数据访问(ops_repo_histograms.go)
      - 实现延迟直方图桶逻辑(ops_repo_latency_histogram_buckets.go)
      - 新增延迟直方图桶测试(ops_repo_latency_histogram_buckets_test.go)
      - 实现指标数据访问(ops_repo_metrics.go)
      - 实现预聚合数据访问(ops_repo_preagg.go)
      - 实现请求详情数据访问(ops_repo_request_details.go)
      - 实现趋势数据访问(ops_repo_trends.go)
      - 实现窗口统计数据访问(ops_repo_window_stats.go)
      - 更新并发缓存支持 ops 场景
      - 注册 repository 依赖注入
      bb530327
    • IanShaw027's avatar
      feat(数据库): 添加运维监控数据模型和数据库迁移脚本 · d55866d3
      IanShaw027 authored
      - 新增 ops 监控数据库迁移脚本(表结构定义)
      - 定义核心数据模型(ops_models.go)
      - 定义告警相关模型(ops_alert_models.go)
      - 定义仪表板数据模型(ops_dashboard_models.go)
      - 定义实时监控数据模型(ops_realtime_models.go)
      - 定义配置相关模型(ops_settings_models.go)
      - 定义趋势分析数据模型(ops_trend_models.go)
      d55866d3
    • IanShaw027's avatar
      feat(基础设施): 添加运维监控功能的基础配置和依赖 · 4b9e47ce
      IanShaw027 authored
      - 更新 .gitignore 排除临时文件
      - 添加 ops 监控相关配置项到 config.yaml
      - 更新 Go 依赖包(go.mod/go.sum)
      - 扩展 config.go 支持 ops 监控配置
      - 新增上下文键定义(ClientRequestID)
      4b9e47ce
    • 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