mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
fix: 修复专属账号下拉框,仅显示dedicated类型账号
- 修改CreateApiKeyModal和EditApiKeyModal的过滤逻辑 - 专属账号下拉框只显示accountType='dedicated'的账号 - 移除accountType='group'的账号,这些账号通过分组调度 - 更新标签文字为'专属账号'以更准确描述
This commit is contained in:
@@ -446,11 +446,11 @@
|
||||
</option>
|
||||
</optgroup>
|
||||
<optgroup
|
||||
v-if="localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-oauth').length > 0"
|
||||
label="Claude OAuth 账号"
|
||||
v-if="localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-oauth').length > 0"
|
||||
label="Claude OAuth 专属账号"
|
||||
>
|
||||
<option
|
||||
v-for="account in localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-oauth')"
|
||||
v-for="account in localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-oauth')"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
>
|
||||
@@ -458,11 +458,11 @@
|
||||
</option>
|
||||
</optgroup>
|
||||
<optgroup
|
||||
v-if="localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-console').length > 0"
|
||||
label="Claude Console 账号"
|
||||
v-if="localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-console').length > 0"
|
||||
label="Claude Console 专属账号"
|
||||
>
|
||||
<option
|
||||
v-for="account in localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-console')"
|
||||
v-for="account in localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-console')"
|
||||
:key="account.id"
|
||||
:value="`console:${account.id}`"
|
||||
>
|
||||
@@ -494,11 +494,11 @@
|
||||
</option>
|
||||
</optgroup>
|
||||
<optgroup
|
||||
v-if="localAccounts.gemini.filter(a => a.isDedicated).length > 0"
|
||||
label="Gemini 账号"
|
||||
v-if="localAccounts.gemini.filter(a => a.accountType === 'dedicated').length > 0"
|
||||
label="Gemini 专属账号"
|
||||
>
|
||||
<option
|
||||
v-for="account in localAccounts.gemini.filter(a => a.isDedicated)"
|
||||
v-for="account in localAccounts.gemini.filter(a => a.accountType === 'dedicated')"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
>
|
||||
@@ -757,7 +757,7 @@ const refreshAccounts = async () => {
|
||||
claudeAccounts.push({
|
||||
...account,
|
||||
platform: 'claude-oauth',
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
isDedicated: account.accountType === 'dedicated' // 保留以便向后兼容
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -767,7 +767,7 @@ const refreshAccounts = async () => {
|
||||
claudeAccounts.push({
|
||||
...account,
|
||||
platform: 'claude-console',
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
isDedicated: account.accountType === 'dedicated' // 保留以便向后兼容
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -777,7 +777,7 @@ const refreshAccounts = async () => {
|
||||
if (geminiData.success) {
|
||||
localAccounts.value.gemini = (geminiData.data || []).map(account => ({
|
||||
...account,
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
isDedicated: account.accountType === 'dedicated' // 保留以便向后兼容
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -315,11 +315,11 @@
|
||||
</option>
|
||||
</optgroup>
|
||||
<optgroup
|
||||
v-if="localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-oauth').length > 0"
|
||||
label="Claude OAuth 账号"
|
||||
v-if="localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-oauth').length > 0"
|
||||
label="Claude OAuth 专属账号"
|
||||
>
|
||||
<option
|
||||
v-for="account in localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-oauth')"
|
||||
v-for="account in localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-oauth')"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
>
|
||||
@@ -327,11 +327,11 @@
|
||||
</option>
|
||||
</optgroup>
|
||||
<optgroup
|
||||
v-if="localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-console').length > 0"
|
||||
label="Claude Console 账号"
|
||||
v-if="localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-console').length > 0"
|
||||
label="Claude Console 专属账号"
|
||||
>
|
||||
<option
|
||||
v-for="account in localAccounts.claude.filter(a => a.isDedicated && a.platform === 'claude-console')"
|
||||
v-for="account in localAccounts.claude.filter(a => a.accountType === 'dedicated' && a.platform === 'claude-console')"
|
||||
:key="account.id"
|
||||
:value="`console:${account.id}`"
|
||||
>
|
||||
@@ -363,11 +363,11 @@
|
||||
</option>
|
||||
</optgroup>
|
||||
<optgroup
|
||||
v-if="localAccounts.gemini.filter(a => a.isDedicated).length > 0"
|
||||
label="Gemini 账号"
|
||||
v-if="localAccounts.gemini.filter(a => a.accountType === 'dedicated').length > 0"
|
||||
label="Gemini 专属账号"
|
||||
>
|
||||
<option
|
||||
v-for="account in localAccounts.gemini.filter(a => a.isDedicated)"
|
||||
v-for="account in localAccounts.gemini.filter(a => a.accountType === 'dedicated')"
|
||||
:key="account.id"
|
||||
:value="account.id"
|
||||
>
|
||||
@@ -700,7 +700,7 @@ const refreshAccounts = async () => {
|
||||
claudeAccounts.push({
|
||||
...account,
|
||||
platform: 'claude-oauth',
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
isDedicated: account.accountType === 'dedicated' // 保留以便向后兼容
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -710,7 +710,7 @@ const refreshAccounts = async () => {
|
||||
claudeAccounts.push({
|
||||
...account,
|
||||
platform: 'claude-console',
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
isDedicated: account.accountType === 'dedicated' // 保留以便向后兼容
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ const expandedApiKeys = ref({})
|
||||
const apiKeyModelStats = ref({})
|
||||
const apiKeyDateFilters = ref({})
|
||||
const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)])
|
||||
const accounts = ref({ claude: [], gemini: [] })
|
||||
const accounts = ref({ claude: [], gemini: [], claudeGroups: [], geminiGroups: [] })
|
||||
const editingExpiryKey = ref(null)
|
||||
const expiryEditModalRef = ref(null)
|
||||
|
||||
@@ -1102,10 +1102,11 @@ const paginatedApiKeys = computed(() => {
|
||||
// 加载账户列表
|
||||
const loadAccounts = async () => {
|
||||
try {
|
||||
const [claudeData, claudeConsoleData, geminiData] = await Promise.all([
|
||||
const [claudeData, claudeConsoleData, geminiData, groupsData] = await Promise.all([
|
||||
apiClient.get('/admin/claude-accounts'),
|
||||
apiClient.get('/admin/claude-console-accounts'),
|
||||
apiClient.get('/admin/gemini-accounts')
|
||||
apiClient.get('/admin/gemini-accounts'),
|
||||
apiClient.get('/admin/account-groups')
|
||||
])
|
||||
|
||||
// 合并Claude OAuth账户和Claude Console账户
|
||||
@@ -1122,23 +1123,27 @@ const loadAccounts = async () => {
|
||||
}
|
||||
|
||||
if (claudeConsoleData.success) {
|
||||
claudeConsoleData.data?.forEach(account => {
|
||||
claudeAccounts.push({
|
||||
...account,
|
||||
platform: 'claude-console',
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
})
|
||||
})
|
||||
// 将 Claude Console 账号合并到 claude 数组中
|
||||
const consoleAccounts = (claudeConsoleData.data || []).map(acc => ({
|
||||
...acc,
|
||||
platform: 'claude-console'
|
||||
}))
|
||||
accounts.value.claude = [...accounts.value.claude, ...consoleAccounts]
|
||||
}
|
||||
|
||||
accounts.value.claude = claudeAccounts
|
||||
|
||||
if (geminiData.success) {
|
||||
accounts.value.gemini = (geminiData.data || []).map(account => ({
|
||||
...account,
|
||||
isDedicated: account.accountType === 'dedicated'
|
||||
}))
|
||||
}
|
||||
|
||||
if (groupsData.success) {
|
||||
// 处理分组数据
|
||||
const allGroups = groupsData.data || []
|
||||
accounts.value.claudeGroups = allGroups.filter(g => g.platform === 'claude')
|
||||
accounts.value.geminiGroups = allGroups.filter(g => g.platform === 'gemini')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载账户列表失败:', error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user