feat(usage): 错误请求对齐用量明细(UI/排序/筛选/列设置)

错误请求列表(/admin/usage 错误 tab、Ops 弹窗、用户端 /usage 错误 tab)
对齐用量明细的交互与信息密度。Squash of:

- feat(usage): 错误请求全面对齐用量明细(UI/列序/排序/筛选/列设置/新列)
- refactor(usage): 错误表提取共享徽章工具与 IP 批量工具条,后端排序解析归并 SetSort
- feat(usage): /admin/usage 错误请求新增分类过滤
- fix(ops): 错误列表 phase=upstream 过滤生效,守卫豁免改为显式 opt-in
- fix(ops): 错误列表用户列回退显示已删除 KEY 所有者
- fix(usage): 错误请求状态码排序对齐展示/过滤,筛选项改固定常用码
This commit is contained in:
DaydreamCoding
2026-07-03 23:02:27 +08:00
parent 2649573b99
commit ebbdc70311
25 changed files with 1108 additions and 459 deletions
+14 -4
View File
@@ -930,11 +930,16 @@ export interface OpsErrorLog {
requested_model?: string
upstream_model?: string
request_type?: number | null
user_agent?: string
// 已删除 KEY 所有者(INVALID_API_KEY 归因快照):认证失败行 user_id 为空,
// 用户列以此回退显示所有者
deleted_key_owner_user_id?: number | null
deleted_key_owner_email?: string | null
}
export interface OpsErrorDetail extends OpsErrorLog {
error_body: string
user_agent: string
// Upstream context (optional; enriched by gateway services)
upstream_status_code?: number | null
@@ -950,10 +955,9 @@ export interface OpsErrorDetail extends OpsErrorLog {
is_business_limited: boolean
// Deleted key owner info (INVALID_API_KEY attribution)
// Deleted key owner info (INVALID_API_KEY attribution);
// owner user_id/email 已上移到 OpsErrorLog(列表用户列回退)
attempted_key_prefix?: string | null
deleted_key_owner_user_id?: number | null
deleted_key_owner_email?: string | null
deleted_key_name?: string | null
// Bound (non-deleted) key prefix, snapshotted at error time
@@ -1098,6 +1102,8 @@ export type OpsErrorListQueryParams = {
model?: string
phase?: string
// 分类(用户侧粗分类码,如 auth/rate_limit/upstream),后端反查为 phase/type ANY 条件
category?: string
error_owner?: string
error_source?: string
resolved?: string
@@ -1106,6 +1112,10 @@ export type OpsErrorListQueryParams = {
q?: string
status_codes?: string
status_codes_other?: string
// 服务端排序,列白名单见后端 opsErrorLogsOrderBy(created_at/model/status_code)
sort_by?: string
sort_order?: 'asc' | 'desc'
}
// Legacy unified endpoints
+4
View File
@@ -86,6 +86,10 @@ export interface AdminUsageQueryParams extends UsageQueryParams {
billing_mode?: string
sort_by?: string
sort_order?: 'asc' | 'desc'
// 错误请求 tab 专属筛选(仅传给错误列表接口;共用同一 filters 对象)
error_phase?: string | null
error_category?: string | null
status_code?: number | null
}
// ==================== API Functions ====================