mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
feat: 支持Gemini-Api接入
This commit is contained in:
@@ -374,6 +374,26 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 创建Gemini API账户
|
||||
const createGeminiApiAccount = async (data) => {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
const response = await apiClient.post('/admin/gemini-api-accounts', data)
|
||||
if (response.success) {
|
||||
await fetchGeminiAccounts()
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error(response.message || '创建Gemini API账户失败')
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
throw err
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 更新Claude账户
|
||||
const updateClaudeAccount = async (id, data) => {
|
||||
loading.value = true
|
||||
@@ -514,6 +534,26 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 更新Gemini API账户
|
||||
const updateGeminiApiAccount = async (id, data) => {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
const response = await apiClient.put(`/admin/gemini-api-accounts/${id}`, data)
|
||||
if (response.success) {
|
||||
await fetchGeminiAccounts()
|
||||
return response
|
||||
} else {
|
||||
throw new Error(response.message || '更新Gemini API账户失败')
|
||||
}
|
||||
} catch (err) {
|
||||
error.value = err.message
|
||||
throw err
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 切换账户状态
|
||||
const toggleAccount = async (platform, id) => {
|
||||
loading.value = true
|
||||
@@ -858,6 +898,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
updateDroidAccount,
|
||||
createAzureOpenAIAccount,
|
||||
createOpenAIResponsesAccount,
|
||||
createGeminiApiAccount,
|
||||
updateClaudeAccount,
|
||||
updateClaudeConsoleAccount,
|
||||
updateBedrockAccount,
|
||||
@@ -865,6 +906,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
updateOpenAIAccount,
|
||||
updateAzureOpenAIAccount,
|
||||
updateOpenAIResponsesAccount,
|
||||
updateGeminiApiAccount,
|
||||
toggleAccount,
|
||||
deleteAccount,
|
||||
refreshClaudeToken,
|
||||
|
||||
Reference in New Issue
Block a user