From 9d3ec9e627e164bf3020970026956246d6ce9442 Mon Sep 17 00:00:00 2001 From: shaw Date: Fri, 2 Jan 2026 15:53:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(keys):=20=E9=80=82=E9=85=8D=20Antigravity?= =?UTF-8?q?=20=E5=92=8C=20Gemini=20=E5=B9=B3=E5=8F=B0=E7=9A=84=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=95=99=E7=A8=8B=E4=B8=8E=20CCS=20=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - UseKeyModal: 添加 Antigravity 两级 Tab (Claude Code / Gemini CLI) - UseKeyModal: 添加 Gemini 平台的 Gemini CLI 教程 - UseKeyModal: Antigravity 平台统一使用 /antigravity 后缀 - KeysView: CCS 导入支持 Antigravity (询问客户端) / Gemini / OpenAI - i18n: 添加相关中英文翻译 --- frontend/src/components/keys/UseKeyModal.vue | 185 ++++++++++++++++--- frontend/src/i18n/locales/en.ts | 22 ++- frontend/src/i18n/locales/zh.ts | 22 ++- frontend/src/views/user/KeysView.vue | 108 ++++++++++- 4 files changed, 307 insertions(+), 30 deletions(-) diff --git a/frontend/src/components/keys/UseKeyModal.vue b/frontend/src/components/keys/UseKeyModal.vue index 9414523d..7db67b96 100644 --- a/frontend/src/components/keys/UseKeyModal.vue +++ b/frontend/src/components/keys/UseKeyModal.vue @@ -28,7 +28,29 @@ {{ platformDescription }}

- + +
+ +
+ +
+ + + +
(null) const selectedKey = ref(null) const copiedKeyId = ref(null) const groupSelectorKeyId = ref(null) @@ -871,8 +916,48 @@ const closeModals = () => { } } -const importToCcswitch = (apiKey: string) => { +const importToCcswitch = (row: ApiKey) => { + const platform = row.group?.platform || 'anthropic' + + // For antigravity platform, show client selection dialog + if (platform === 'antigravity') { + pendingCcsRow.value = row + showCcsClientSelect.value = true + return + } + + // For other platforms, execute directly + executeCcsImport(row, platform === 'gemini' ? 'gemini' : 'claude') +} + +const executeCcsImport = (row: ApiKey, clientType: 'claude' | 'gemini') => { const baseUrl = publicSettings.value?.api_base_url || window.location.origin + const platform = row.group?.platform || 'anthropic' + + // Determine app name and endpoint based on platform and client type + let app: string + let endpoint: string + + if (platform === 'antigravity') { + // Antigravity always uses /antigravity suffix + app = clientType === 'gemini' ? 'gemini' : 'claude' + endpoint = `${baseUrl}/antigravity` + } else { + switch (platform) { + case 'openai': + app = 'codex' + endpoint = baseUrl + break + case 'gemini': + app = 'gemini' + endpoint = baseUrl + break + default: // anthropic + app = 'claude' + endpoint = baseUrl + } + } + const usageScript = `({ request: { url: "{{baseUrl}}/v1/usage", @@ -889,11 +974,11 @@ const importToCcswitch = (apiKey: string) => { })` const params = new URLSearchParams({ resource: 'provider', - app: 'claude', + app: app, name: 'sub2api', homepage: baseUrl, - endpoint: baseUrl, - apiKey: apiKey, + endpoint: endpoint, + apiKey: row.key, configFormat: 'json', usageEnabled: 'true', usageScript: btoa(usageScript), @@ -916,6 +1001,19 @@ const importToCcswitch = (apiKey: string) => { } } +const handleCcsClientSelect = (clientType: 'claude' | 'gemini') => { + if (pendingCcsRow.value) { + executeCcsImport(pendingCcsRow.value, clientType) + } + showCcsClientSelect.value = false + pendingCcsRow.value = null +} + +const closeCcsClientSelect = () => { + showCcsClientSelect.value = false + pendingCcsRow.value = null +} + onMounted(() => { loadApiKeys() loadGroups()