feat: 支持Gemini-Api接入

This commit is contained in:
shaw
2025-11-23 22:00:13 +08:00
parent b197cba325
commit bae39d5468
13 changed files with 2355 additions and 287 deletions

View File

@@ -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,