feat: add Sora admin backend and fix type inconsistencies
Some checks failed
CI / test (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
Security Scan / backend-security (push) Has been cancelled
Security Scan / frontend-security (push) Has been cancelled

Backend changes:
- Add SoraHandler for admin Sora management APIs
  - GET /api/v1/admin/sora/stats - system statistics
  - GET /api/v1/admin/sora/users - user storage stats
  - GET /api/v1/admin/sora/generations - generation records
  - DELETE /api/v1/admin/sora/users/:id/storage - clear user storage
- Add sora_storage_quota_bytes to AdminUser DTO
- Add SoraStorageQuotaBytes to UpdateUserInput for admin user updates
- Add comprehensive tests for SoraHandler

Frontend changes:
- Add soraAdminAPI for Sora management
- Add sora_storage_quota_bytes and sora_storage_used_bytes to AdminUser type
- Add Sora storage quota field to UserEditModal (GB unit)
- Fix UsageLog type: add media_type, fix duration_ms to optional
- Fix AdminUsageLog type: add channel_id, billing_tier

Test fixes:
- Add window.matchMedia mock to AccountUsageCell.spec.ts
- Add tlsFingerprintProfileAPI mock to EditAccountModal.spec.ts
- Fix loadTLSProfiles function order in EditAccountModal.vue
- Fix translation key references in AccountStatusIndicator.spec.ts
This commit is contained in:
User
2026-04-16 09:20:23 +08:00
parent eb5d32553d
commit 2d59b9ebfc
18 changed files with 564 additions and 39 deletions

View File

@@ -45,6 +45,10 @@ export interface AdminUser extends User {
group_rates?: Record<number, number>
// 当前并发数(仅管理员列表接口返回)
current_concurrency?: number
// Sora 存储配额单位字节0 表示使用分组或系统默认配额)
sora_storage_quota_bytes: number
// Sora 存储已用字节
sora_storage_used_bytes: number
}
export interface LoginRequest {
@@ -1016,12 +1020,13 @@ export interface UsageLog {
request_type?: UsageRequestType
stream: boolean
openai_ws_mode?: boolean
duration_ms: number
duration_ms: number | null
first_token_ms: number | null
// 图片生成字段
image_count: number
image_size: string | null
media_type?: string | null
// User-Agent
user_agent: string | null
@@ -1049,6 +1054,12 @@ export interface AdminUsageLog extends UsageLog {
upstream_model?: string | null
model_mapping_chain?: string | null
// 渠道 ID
channel_id?: number | null
// 计费层级标签per_request/image 模式)
billing_tier?: string | null
// 账号计费倍率(仅管理员可见)
account_rate_multiplier?: number | null