mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
feat: 为claude类型账号增加测试功能
This commit is contained in:
@@ -1187,6 +1187,15 @@
|
||||
<i class="fas fa-chart-line" />
|
||||
<span class="ml-1">详情</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="canTestAccount(account)"
|
||||
class="rounded bg-cyan-100 px-2.5 py-1 text-xs font-medium text-cyan-700 transition-colors hover:bg-cyan-200 dark:bg-cyan-900/40 dark:text-cyan-300 dark:hover:bg-cyan-800/50"
|
||||
:title="'测试账户连通性'"
|
||||
@click="openAccountTestModal(account)"
|
||||
>
|
||||
<i class="fas fa-vial" />
|
||||
<span class="ml-1">测试</span>
|
||||
</button>
|
||||
<button
|
||||
class="rounded bg-blue-100 px-2.5 py-1 text-xs font-medium text-blue-700 transition-colors hover:bg-blue-200"
|
||||
:title="'编辑账户'"
|
||||
@@ -1619,6 +1628,15 @@
|
||||
详情
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="canTestAccount(account)"
|
||||
class="flex flex-1 items-center justify-center gap-1 rounded-lg bg-cyan-50 px-3 py-2 text-xs text-cyan-600 transition-colors hover:bg-cyan-100 dark:bg-cyan-900/40 dark:text-cyan-300 dark:hover:bg-cyan-800/50"
|
||||
@click="openAccountTestModal(account)"
|
||||
>
|
||||
<i class="fas fa-vial" />
|
||||
测试
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="flex-1 rounded-lg bg-gray-50 px-3 py-2 text-xs text-gray-600 transition-colors hover:bg-gray-100"
|
||||
@click="editAccount(account)"
|
||||
@@ -1784,6 +1802,13 @@
|
||||
@close="closeAccountExpiryEdit"
|
||||
@save="handleSaveAccountExpiry"
|
||||
/>
|
||||
|
||||
<!-- 账户测试弹窗 -->
|
||||
<AccountTestModal
|
||||
:account="testingAccount"
|
||||
:show="showAccountTestModal"
|
||||
@close="closeAccountTestModal"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1796,6 +1821,7 @@ import AccountForm from '@/components/accounts/AccountForm.vue'
|
||||
import CcrAccountForm from '@/components/accounts/CcrAccountForm.vue'
|
||||
import AccountUsageDetailModal from '@/components/accounts/AccountUsageDetailModal.vue'
|
||||
import AccountExpiryEditModal from '@/components/accounts/AccountExpiryEditModal.vue'
|
||||
import AccountTestModal from '@/components/accounts/AccountTestModal.vue'
|
||||
import ConfirmModal from '@/components/common/ConfirmModal.vue'
|
||||
import CustomDropdown from '@/components/common/CustomDropdown.vue'
|
||||
|
||||
@@ -1858,6 +1884,10 @@ const supportedUsagePlatforms = [
|
||||
const editingExpiryAccount = ref(null)
|
||||
const expiryEditModalRef = ref(null)
|
||||
|
||||
// 测试弹窗状态
|
||||
const showAccountTestModal = ref(false)
|
||||
const testingAccount = ref(null)
|
||||
|
||||
// 缓存状态标志
|
||||
const apiKeysLoaded = ref(false) // 用于其他功能
|
||||
const bindingCountsLoaded = ref(false) // 轻量级绑定计数缓存
|
||||
@@ -2021,6 +2051,27 @@ const closeAccountUsageModal = () => {
|
||||
selectedAccountForUsage.value = null
|
||||
}
|
||||
|
||||
// 测试账户连通性相关函数
|
||||
const supportedTestPlatforms = ['claude', 'claude-console']
|
||||
|
||||
const canTestAccount = (account) => {
|
||||
return !!account && supportedTestPlatforms.includes(account.platform)
|
||||
}
|
||||
|
||||
const openAccountTestModal = (account) => {
|
||||
if (!canTestAccount(account)) {
|
||||
showToast('该账户类型暂不支持测试', 'warning')
|
||||
return
|
||||
}
|
||||
testingAccount.value = account
|
||||
showAccountTestModal.value = true
|
||||
}
|
||||
|
||||
const closeAccountTestModal = () => {
|
||||
showAccountTestModal.value = false
|
||||
testingAccount.value = null
|
||||
}
|
||||
|
||||
// 计算排序后的账户列表
|
||||
const sortedAccounts = computed(() => {
|
||||
let sourceAccounts = accounts.value
|
||||
|
||||
Reference in New Issue
Block a user