Conversation
- 新增批量获取配额 API: GET /antigravity/providers/quotas - 缓存时间从 5 分钟延长到 10 分钟 - 创建 AntigravityQuotasProvider 上下文实现懒加载 - 优化 provider-row 布局: - 移除左侧类型图标,改为显示 Clients 图标 - Antigravity provider 移除邮箱显示,只显示 Claude 余额进度条 - 减少不必要的 API 请求,提升性能
📝 Walkthrough步骤说明引入批量Antigravity配额查询功能,包括后端批量检索API、React context管理层、HTTP传输层支持和前端页面集成,实现统一的配额缓存策略。 变更
序列图sequenceDiagram
participant Client as 浏览器客户端
participant Context as AntigravityQuotasProvider
participant Hook as useAntigravityBatchQuotas
participant Transport as HttpTransport
participant API as 后端API
participant Cache as 配额缓存
Client->>Context: 挂载页面(使用Provider包装)
Context->>Hook: 初始化Hook
Hook->>Transport: getAntigravityBatchQuotas()
Transport->>API: GET /api/antigravity/providers/quotas
alt 缓存有效(10分钟内)
API->>Cache: 检查缓存
Cache-->>API: 返回缓存数据
else 缓存过期或不存在
API->>API: 逐个获取提供者配额
API->>API: 应用10分钟缓存窗口
API->>Cache: 持久化结果
end
API-->>Transport: 返回 { quotas: Record<providerId, QuotaData> }
Transport-->>Hook: 更新配额数据
Hook-->>Context: 广播quotas和isLoading状态
Context->>Client: 暴露getQuotaForProvider()访问器
Client->>Client: 组件消费useAntigravityQuotaFromContext(providerId)
Client->>Client: 渲染Claude配额进度条和重置时间
预估代码审查工作量🎯 3 (中等) | ⏱️ ~20 分钟 建议审查员
诗
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (12)
🧰 Additional context used🧬 Code graph analysis (8)web/src/lib/transport/interface.ts (1)
web/src/hooks/queries/use-providers.ts (2)
web/src/contexts/antigravity-quotas-context.tsx (4)
web/src/lib/transport/http-transport.ts (2)
internal/handler/antigravity.go (1)
web/src/components/routes/ClientTypeRoutesContent.tsx (1)
web/src/pages/providers/components/provider-row.tsx (3)
web/src/pages/client-routes/components/provider-row.tsx (3)
🔇 Additional comments (19)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
GET /antigravity/providers/quotas,减少 N 个单独请求为 1 个批量请求AntigravityQuotasProvider上下文实现懒加载,只有进入相关页面才发起请求Test plan
Summary by CodeRabbit
发布说明
新功能
改进
✏️ Tip: You can customize this high-level summary in your review settings.