mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor: Antigravity/Codex 服务重构为插件化适配器架构
- 将 Antigravity 和 Codex 从独立模块迁移至 src/services/provider/adapters/ 插件体系 - 新增 provider_types 和 oauth_token 模块,移除 maintenance_scheduler 中的 OAuth 定时刷新 - 增强 admin API:扩展 keys 和 provider_query 端点,新增 dashboard 路由 - 大幅增强 ProviderDetailDrawer 组件,新增 AntigravityQuotaDialog - 改进 handler 基类(chat/cli)和错误分类器 - 优化 fetch_scheduler 和 upstream_fetcher - 前端 UI 组件清理和优化 - 更新测试以匹配新模块结构
This commit is contained in:
@@ -1001,6 +1001,37 @@ class DashboardDailyStatsAdapter(DashboardAdapter):
|
||||
}
|
||||
)
|
||||
|
||||
# 补充 unique_models / unique_providers
|
||||
# query_time_series 使用小时粒度数据,不含这些维度统计
|
||||
# 直接从 Usage 表按本地日 UTC 范围查询,避免 StatsDaily 历史数据未回填的问题
|
||||
granularity = (self.time_range.granularity or "day").lower()
|
||||
if formatted and granularity == "day":
|
||||
local_days = self.time_range.get_local_day_hours()
|
||||
enrichment: dict[str, dict] = {}
|
||||
|
||||
for local_date, day_start_utc, day_end_utc in local_days:
|
||||
q = db.query(
|
||||
func.count(func.distinct(Usage.model)).label("um"),
|
||||
func.count(func.distinct(Usage.provider_name)).label("up"),
|
||||
).filter(
|
||||
Usage.created_at >= day_start_utc,
|
||||
Usage.created_at < day_end_utc,
|
||||
)
|
||||
if not is_admin:
|
||||
q = q.filter(Usage.user_id == user.id)
|
||||
row = q.first()
|
||||
if row:
|
||||
enrichment[local_date.isoformat()] = {
|
||||
"unique_models": row.um or 0,
|
||||
"unique_providers": row.up or 0,
|
||||
}
|
||||
|
||||
for item in formatted:
|
||||
date_key = item["date"][:10] # YYYY-MM-DD
|
||||
if date_key in enrichment:
|
||||
item["unique_models"] = enrichment[date_key]["unique_models"]
|
||||
item["unique_providers"] = enrichment[date_key]["unique_providers"]
|
||||
|
||||
# Model summary (use Usage directly for now)
|
||||
start_utc, end_utc = self.time_range.to_utc_datetime_range()
|
||||
model_query = db.query(
|
||||
|
||||
Reference in New Issue
Block a user