feat: 平台图标与计费修复

- fix(billing): 修复 OpenAI 兼容 API 缓存 token 重复计费问题
- fix(auth): 隐藏数据库错误详情,返回通用服务不可用错误
- feat(ui): 新增 PlatformIcon 组件,GroupBadge 支持平台颜色区分
- feat(ui): 账号管理新增重置状态按钮,重授权后自动清除错误
- feat(ui): 分组管理新增计费类型列,显示订阅限额信息
- ui: 首页 GPT 状态改为已支持
This commit is contained in:
shaw
2025-12-23 10:01:58 +08:00
parent 6c469b42ed
commit fda753278c
11 changed files with 240 additions and 44 deletions

View File

@@ -139,6 +139,17 @@
<template #cell-actions="{ row }">
<div class="flex items-center gap-1">
<!-- Reset Status button for error accounts -->
<button
v-if="row.status === 'error'"
@click="handleResetStatus(row)"
class="p-2 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 text-red-500 hover:text-red-600 dark:hover:text-red-400 transition-colors"
:title="t('admin.accounts.resetStatus')"
>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="1.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3" />
</svg>
</button>
<!-- Clear Rate Limit button -->
<button
v-if="isRateLimited(row) || isOverloaded(row)"
@@ -496,6 +507,23 @@ const handleClearRateLimit = async (account: Account) => {
}
}
// Reset account status (clear error and rate limit)
const handleResetStatus = async (account: Account) => {
try {
// Clear error status
await adminAPI.accounts.clearError(account.id)
// Also clear rate limit if exists
if (isRateLimited(account) || isOverloaded(account)) {
await adminAPI.accounts.clearRateLimit(account.id)
}
appStore.showSuccess(t('admin.accounts.statusReset'))
loadAccounts()
} catch (error: any) {
appStore.showError(error.response?.data?.detail || t('admin.accounts.failedToResetStatus'))
console.error('Error resetting account status:', error)
}
}
// Toggle schedulable
const handleToggleSchedulable = async (account: Account) => {
togglingSchedulable.value = account.id