From 48bd37a74b2feb895ae324757514fed9d3a13343 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 6 Sep 2025 23:57:10 +0800 Subject: [PATCH] feat(ui): unify link/address styles and set primary header color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Links use primary color; removed leading icon - Show API address when website is missing; use secondary text color, non-monospace - Parse base_url from Codex TOML; change fallback copy to "未配置官网地址" - Use primary color for the top-left header title - Clean up unused imports Affected files: - src/components/ProviderList.tsx - src/App.tsx --- src/App.tsx | 2 +- src/components/ProviderList.tsx | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 4590a07..5b96508 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -218,7 +218,7 @@ function App() { {/* Linear 风格的顶部导航 */}
-

+

CC Switch

diff --git a/src/components/ProviderList.tsx b/src/components/ProviderList.tsx index 8afb363..c98036a 100644 --- a/src/components/ProviderList.tsx +++ b/src/components/ProviderList.tsx @@ -1,13 +1,6 @@ import React from "react"; import { Provider } from "../types"; -import { - Play, - Edit3, - Trash2, - ExternalLink, - CheckCircle2, - Users, -} from "lucide-react"; +import { Play, Edit3, Trash2, CheckCircle2, Users } from "lucide-react"; interface ProviderListProps { providers: Record; @@ -24,14 +17,20 @@ const ProviderList: React.FC = ({ onDelete, onEdit, }) => { - // 提取API地址 + // 提取API地址(兼容不同供应商配置:Claude env / Codex TOML) const getApiUrl = (provider: Provider): string => { try { - const config = provider.settingsConfig; - if (config?.env?.ANTHROPIC_BASE_URL) { - return config.env.ANTHROPIC_BASE_URL; + const cfg = provider.settingsConfig; + // Claude/Anthropic: 从 env 中读取 + if (cfg?.env?.ANTHROPIC_BASE_URL) { + return cfg.env.ANTHROPIC_BASE_URL; } - return "未设置"; + // Codex: 从 TOML 配置中解析 base_url + if (typeof cfg?.config === "string" && cfg.config.includes("base_url")) { + const match = cfg.config.match(/base_url\s*=\s*"([^"]+)"/); + if (match && match[1]) return match[1]; + } + return "未配置官网地址"; } catch { return "配置错误"; } @@ -88,21 +87,20 @@ const ProviderList: React.FC = ({ )}
-
+
{provider.websiteUrl ? ( ) : ( - + {apiUrl} )}