mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
fix: 账户列表默认显示限额/限流账号并加固加载健壮性
- 将账户页状态筛选默认值从 normal 改为 all,额度满/限流/异常账号默认可见 - appendAccounts 使用 Array.isArray 兜底接口响应,避免空/异常数据导致“加载账户失败” - 便于在额度耗尽场景查看并处理账号
This commit is contained in:
@@ -2049,7 +2049,7 @@ const bindingCounts = ref({}) // 轻量级绑定计数,用于显示"绑定: X
|
|||||||
const accountGroups = ref([])
|
const accountGroups = ref([])
|
||||||
const groupFilter = ref('all')
|
const groupFilter = ref('all')
|
||||||
const platformFilter = ref('all')
|
const platformFilter = ref('all')
|
||||||
const statusFilter = ref('normal') // 状态过滤 (normal/rateLimited/other/all)
|
const statusFilter = ref('all') // 状态过滤 (normal/rateLimited/other/all)
|
||||||
const searchKeyword = ref('')
|
const searchKeyword = ref('')
|
||||||
const PAGE_SIZE_STORAGE_KEY = 'accountsPageSize'
|
const PAGE_SIZE_STORAGE_KEY = 'accountsPageSize'
|
||||||
const getInitialPageSize = () => {
|
const getInitialPageSize = () => {
|
||||||
@@ -2804,11 +2804,12 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
let openaiResponsesRaw = []
|
let openaiResponsesRaw = []
|
||||||
|
|
||||||
const appendAccounts = (platform, data) => {
|
const appendAccounts = (platform, data) => {
|
||||||
if (!data || data.length === 0) return
|
const list = Array.isArray(data) ? data : []
|
||||||
|
if (list.length === 0) return
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'claude': {
|
case 'claude': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.claudeAccountId?.[acc.id] || 0
|
const boundApiKeysCount = counts.claudeAccountId?.[acc.id] || 0
|
||||||
return { ...acc, platform: 'claude', boundApiKeysCount }
|
return { ...acc, platform: 'claude', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
@@ -2816,7 +2817,7 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'claude-console': {
|
case 'claude-console': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.claudeConsoleAccountId?.[acc.id] || 0
|
const boundApiKeysCount = counts.claudeConsoleAccountId?.[acc.id] || 0
|
||||||
return { ...acc, platform: 'claude-console', boundApiKeysCount }
|
return { ...acc, platform: 'claude-console', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
@@ -2824,12 +2825,12 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'bedrock': {
|
case 'bedrock': {
|
||||||
const items = data.map((acc) => ({ ...acc, platform: 'bedrock', boundApiKeysCount: 0 }))
|
const items = list.map((acc) => ({ ...acc, platform: 'bedrock', boundApiKeysCount: 0 }))
|
||||||
allAccounts.push(...items)
|
allAccounts.push(...items)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'gemini': {
|
case 'gemini': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.geminiAccountId?.[acc.id] || 0
|
const boundApiKeysCount = counts.geminiAccountId?.[acc.id] || 0
|
||||||
return { ...acc, platform: 'gemini', boundApiKeysCount }
|
return { ...acc, platform: 'gemini', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
@@ -2837,7 +2838,7 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'openai': {
|
case 'openai': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.openaiAccountId?.[acc.id] || 0
|
const boundApiKeysCount = counts.openaiAccountId?.[acc.id] || 0
|
||||||
return { ...acc, platform: 'openai', boundApiKeysCount }
|
return { ...acc, platform: 'openai', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
@@ -2845,7 +2846,7 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'azure_openai': {
|
case 'azure_openai': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.azureOpenaiAccountId?.[acc.id] || 0
|
const boundApiKeysCount = counts.azureOpenaiAccountId?.[acc.id] || 0
|
||||||
return { ...acc, platform: 'azure_openai', boundApiKeysCount }
|
return { ...acc, platform: 'azure_openai', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
@@ -2853,16 +2854,16 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'openai-responses': {
|
case 'openai-responses': {
|
||||||
openaiResponsesRaw = data
|
openaiResponsesRaw = list
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'ccr': {
|
case 'ccr': {
|
||||||
const items = data.map((acc) => ({ ...acc, platform: 'ccr', boundApiKeysCount: 0 }))
|
const items = list.map((acc) => ({ ...acc, platform: 'ccr', boundApiKeysCount: 0 }))
|
||||||
allAccounts.push(...items)
|
allAccounts.push(...items)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'droid': {
|
case 'droid': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.droidAccountId?.[acc.id] || acc.boundApiKeysCount || 0
|
const boundApiKeysCount = counts.droidAccountId?.[acc.id] || acc.boundApiKeysCount || 0
|
||||||
return { ...acc, platform: 'droid', boundApiKeysCount }
|
return { ...acc, platform: 'droid', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
@@ -2870,7 +2871,7 @@ const loadAccounts = async (forceReload = false) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'gemini-api': {
|
case 'gemini-api': {
|
||||||
const items = data.map((acc) => {
|
const items = list.map((acc) => {
|
||||||
const boundApiKeysCount = counts.geminiAccountId?.[`api:${acc.id}`] || 0
|
const boundApiKeysCount = counts.geminiAccountId?.[`api:${acc.id}`] || 0
|
||||||
return { ...acc, platform: 'gemini-api', boundApiKeysCount }
|
return { ...acc, platform: 'gemini-api', boundApiKeysCount }
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user