diff --git a/package.json b/package.json index c6037050c..647f24b52 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "proxycast", "private": true, - "version": "0.14.1", + "version": "0.14.2", "type": "module", "repository": { "type": "git", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index cb0c72663..1ca411650 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3367,7 +3367,7 @@ dependencies = [ [[package]] name = "proxycast" -version = "0.14.1" +version = "0.14.2" dependencies = [ "anyhow", "async-stream", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 27592d4c4..f927f4e65 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "proxycast" -version = "0.14.1" +version = "0.14.2" description = "AI API Proxy Desktop App" authors = ["you"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index f136f095f..e40d75a5a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "ProxyCast", - "version": "0.14.1", + "version": "0.14.2", "identifier": "com.proxycast.app", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/components/clients/ProviderForm.tsx b/src/components/clients/ProviderForm.tsx index 1243df53a..ed67f76a4 100644 --- a/src/components/clients/ProviderForm.tsx +++ b/src/components/clients/ProviderForm.tsx @@ -640,10 +640,43 @@ export function ProviderForm({ const handleCredentialSelect = async (credential: CredentialDisplay) => { setSelectedCredentialUuid(credential.uuid); setName(credential.name || `${credential.provider_type} 凭证`); - setIconColor("#22c55e"); - // 根据凭证类型和 appType 设置配置 - // 使用 ProxyCast 代理,凭证池中的凭证通过本地代理访问 + // 判断是否为 API Key 类型凭证(非 OAuth) + const isApiKeyType = !credential.credential_type.includes("oauth"); + + // API Key 类型凭证:直接使用凭证中的 api_key 和 base_url + if (isApiKeyType && credential.api_key) { + setIconColor("#22c55e"); + + if (appType === "claude") { + setApiKey(credential.api_key); + setBaseUrl(credential.base_url || ""); + setJsonManuallyEdited(false); + } else if (appType === "codex") { + setCodexAuth( + JSON.stringify( + { + api_key: credential.api_key, + api_base_url: credential.base_url || "", + }, + null, + 2, + ), + ); + } else if (appType === "gemini") { + setGeminiEnv( + `GEMINI_API_KEY=${credential.api_key}\nGOOGLE_GEMINI_BASE_URL=${credential.base_url || ""}\nGEMINI_MODEL=gemini-2.0-flash`, + ); + } + + setNotes( + `API Key 凭证: ${credential.provider_type} - ${credential.uuid.slice(0, 8)}`, + ); + return; + } + + // OAuth 类型凭证:使用 ProxyCast 代理 + setIconColor("#3b82f6"); try { const config = await getConfig(); const proxyApiKey = config.server.api_key || ""; @@ -673,7 +706,7 @@ export function ProviderForm({ } setNotes( - `使用凭证池: ${credential.provider_type} - ${credential.uuid.slice(0, 8)}`, + `代理凭证: ${credential.provider_type} - ${credential.uuid.slice(0, 8)}`, ); } catch (e) { console.error("Failed to load config:", e);