mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
fix: 1. 修复调度优先级以及手动禁止调度逻辑的问题
2. 优化列表优先级显示
This commit is contained in:
4
web/admin-spa/dist/index.html
vendored
4
web/admin-spa/dist/index.html
vendored
@@ -18,12 +18,12 @@
|
||||
<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>
|
||||
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
|
||||
<link rel="dns-prefetch" href="https://cdnjs.cloudflare.com">
|
||||
<script type="module" crossorigin src="/admin-next/assets/index-yITK4-m_.js"></script>
|
||||
<script type="module" crossorigin src="/admin-next/assets/index-C7KigxvU.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/admin-next/assets/vue-vendor-CKToUHZx.js">
|
||||
<link rel="modulepreload" crossorigin href="/admin-next/assets/vendor-BDiMbLwQ.js">
|
||||
<link rel="modulepreload" crossorigin href="/admin-next/assets/element-plus-B8Fs_0jW.js">
|
||||
<link rel="stylesheet" crossorigin href="/admin-next/assets/element-plus-CPnoEkWW.css">
|
||||
<link rel="stylesheet" crossorigin href="/admin-next/assets/index-DX8B4Y8f.css">
|
||||
<link rel="stylesheet" crossorigin href="/admin-next/assets/index-Ce1o7Q_r.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -138,6 +138,11 @@
|
||||
<i class="fas fa-exclamation-triangle mr-1"></i>
|
||||
限流中 ({{ account.rateLimitStatus.minutesRemaining }}分钟)
|
||||
</span>
|
||||
<span v-if="account.schedulable === false"
|
||||
class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-gray-100 text-gray-700">
|
||||
<i class="fas fa-pause-circle mr-1"></i>
|
||||
不可调度
|
||||
</span>
|
||||
<span v-if="account.status === 'blocked' && account.errorMessage"
|
||||
class="text-xs text-gray-500 mt-1 max-w-xs truncate"
|
||||
:title="account.errorMessage">
|
||||
@@ -153,7 +158,7 @@
|
||||
<div v-if="account.platform === 'claude' || account.platform === 'claude-console'" class="flex items-center gap-2">
|
||||
<div class="w-16 bg-gray-200 rounded-full h-2">
|
||||
<div class="bg-gradient-to-r from-green-500 to-blue-600 h-2 rounded-full transition-all duration-300"
|
||||
:style="{ width: ((100 - (account.priority || 50)) + '%') }"></div>
|
||||
:style="{ width: ((101 - (account.priority || 50)) + '%') }"></div>
|
||||
</div>
|
||||
<span class="text-xs text-gray-700 font-medium min-w-[20px]">
|
||||
{{ account.priority || 50 }}
|
||||
@@ -232,6 +237,24 @@
|
||||
account.isRefreshing ? 'animate-spin' : ''
|
||||
]"></i>
|
||||
</button>
|
||||
<button
|
||||
@click="toggleSchedulable(account)"
|
||||
:disabled="account.isTogglingSchedulable"
|
||||
:class="[
|
||||
'px-3 py-1.5 rounded-lg text-xs font-medium transition-colors',
|
||||
account.isTogglingSchedulable
|
||||
? 'bg-gray-100 text-gray-400 cursor-not-allowed'
|
||||
: account.schedulable
|
||||
? 'bg-green-100 text-green-700 hover:bg-green-200'
|
||||
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
|
||||
]"
|
||||
:title="account.schedulable ? '点击禁用调度' : '点击启用调度'"
|
||||
>
|
||||
<i :class="[
|
||||
'fas',
|
||||
account.schedulable ? 'fa-toggle-on' : 'fa-toggle-off'
|
||||
]"></i>
|
||||
</button>
|
||||
<button
|
||||
@click="editAccount(account)"
|
||||
class="px-3 py-1.5 bg-blue-100 text-blue-700 rounded-lg text-xs font-medium hover:bg-blue-200 transition-colors"
|
||||
@@ -571,6 +594,41 @@ const refreshToken = async (account) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 切换调度状态
|
||||
const toggleSchedulable = async (account) => {
|
||||
if (account.isTogglingSchedulable) return
|
||||
|
||||
try {
|
||||
account.isTogglingSchedulable = true
|
||||
|
||||
let endpoint
|
||||
if (account.platform === 'claude') {
|
||||
endpoint = `/admin/claude-accounts/${account.id}/toggle-schedulable`
|
||||
} else if (account.platform === 'claude-console') {
|
||||
endpoint = `/admin/claude-console-accounts/${account.id}/toggle-schedulable`
|
||||
} else {
|
||||
showToast('Gemini账户暂不支持调度控制', 'warning')
|
||||
return
|
||||
}
|
||||
|
||||
const data = await apiClient.put(endpoint)
|
||||
|
||||
if (data.success) {
|
||||
account.schedulable = data.schedulable
|
||||
showToast(
|
||||
data.schedulable ? '已启用调度' : '已禁用调度',
|
||||
'success'
|
||||
)
|
||||
} else {
|
||||
showToast(data.message || '操作失败', 'error')
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('切换调度状态失败', 'error')
|
||||
} finally {
|
||||
account.isTogglingSchedulable = false
|
||||
}
|
||||
}
|
||||
|
||||
// 处理创建成功
|
||||
const handleCreateSuccess = () => {
|
||||
showCreateAccountModal.value = false
|
||||
|
||||
Reference in New Issue
Block a user