fix: 移除后端普通用户使用统计API中的提供商信息/修复下拉菜单悬停效果 (#121)

* fix: 移除普通用户使用统计页面的提供商信息

普通用户不应该看到后端使用的提供商信息,此前前端筛选框和后端 API
都泄露了这些数据。

- 前端:为提供商筛选下拉菜单添加 isAdmin 条件
- 后端:移除 summary_by_provider 和 records 中的 provider 字段
- 补充:添加遗漏的 first_byte_time_ms 字段

* fix: 修复 SelectItem 下拉菜单悬停高亮效果

将 hover:bg-primary/10 改为 data-[highlighted]:bg-accent,与
DropdownMenuItem 保持一致。radix-vue 使用 data-highlighted 属性
控制高亮状态,这样键盘导航和鼠标悬停的高亮行为才能正确同步。

---------

Co-authored-by: LewisPen <LewisPen@nyadoo.com>
This commit is contained in:
NyaDoo
2026-01-23 18:57:41 +08:00
committed by GitHub
parent 2256ad1233
commit cddccd2b99
3 changed files with 6 additions and 4 deletions

View File

@@ -14,7 +14,9 @@ const props = defineProps<Props>()
const itemClass = computed(() =>
cn(
'relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-sm outline-none hover:bg-primary/10 focus:bg-primary/15 text-foreground transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
'relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-sm outline-none',
'data-[highlighted]:bg-accent focus:bg-accent text-foreground',
'transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
props.class
)
)

View File

@@ -90,8 +90,9 @@
</SelectContent>
</Select>
<!-- 提供商筛选 -->
<!-- 提供商筛选仅管理员可见 -->
<Select
v-if="isAdmin"
v-model:open="filterProviderSelectOpen"
:model-value="filterProvider"
@update:model-value="$emit('update:filterProvider', $event)"

View File

@@ -857,7 +857,6 @@ class GetUsageAdapter(AuthenticatedApiAdapter):
"quota_usd": user.quota_usd,
"used_usd": user.used_usd,
"summary_by_model": summary_by_model,
"summary_by_provider": summary_by_provider,
# 分页信息
"pagination": {
"total": total_records,
@@ -868,7 +867,6 @@ class GetUsageAdapter(AuthenticatedApiAdapter):
"records": [
{
"id": r.id,
"provider": r.provider_name,
"model": r.model,
"target_model": r.target_model, # 映射后的目标模型名
"api_format": r.api_format,
@@ -877,6 +875,7 @@ class GetUsageAdapter(AuthenticatedApiAdapter):
"total_tokens": r.total_tokens,
"cost": r.total_cost_usd,
"response_time_ms": r.response_time_ms,
"first_byte_time_ms": r.first_byte_time_ms,
"is_stream": r.is_stream,
"status": r.status, # 请求状态: pending, streaming, completed, failed
"created_at": r.created_at.isoformat(),