From e9ad15bf6ff0b96f4bf4063c041cfdbf5d07685e Mon Sep 17 00:00:00 2001 From: Haze <709547807@qq.com> Date: Fri, 6 Feb 2026 05:11:39 +0800 Subject: [PATCH] fix(ui): move chat controls to header, add new session, fix settings layout Chat page: - Move session selector, refresh, thinking toggle to the Header bar (same level as "Chat" title) instead of inside the chat content area - Add "New Session" button (+ icon) to create fresh chat sessions - Remove duplicate toolbar from chat body Settings page: - Remove max-w-2xl constraint so cards fill available width - Redesign provider cards: compact layout with key + actions in one row - Shorten API key display (sk-...df67 format instead of full masked key) - Move edit/delete/star buttons inside the key row background area - Remove duplicate "AI Providers" heading (already in card header) --- src/components/settings/ProvidersSettings.tsx | 142 +++++++++--------- src/pages/Settings/index.tsx | 2 +- 2 files changed, 75 insertions(+), 69 deletions(-) diff --git a/src/components/settings/ProvidersSettings.tsx b/src/components/settings/ProvidersSettings.tsx index 298225030..03315b742 100644 --- a/src/components/settings/ProvidersSettings.tsx +++ b/src/components/settings/ProvidersSettings.tsx @@ -101,15 +101,9 @@ export function ProvidersSettings() { }; return ( -
-
-
-

AI Providers

-

- Configure your AI model providers and API keys -

-
- @@ -180,6 +174,21 @@ interface ProviderCardProps { onValidateKey: (key: string) => Promise<{ valid: boolean; error?: string }>; } +/** + * Shorten a masked key to a more readable format. + * e.g. "sk-or-v1-a20a****df67" -> "sk-...df67" + */ +function shortenKeyDisplay(masked: string | null): string { + if (!masked) return 'No key'; + // Show first 4 chars + last 4 chars + if (masked.length > 12) { + const prefix = masked.substring(0, 4); + const suffix = masked.substring(masked.length - 4); + return `${prefix}...${suffix}`; + } + return masked; +} + function ProviderCard({ provider, isDefault, @@ -225,89 +234,86 @@ function ProviderCard({ return ( - -
+ + {/* Top row: icon + name + toggle */} +
- {typeInfo?.icon || '⚙️'} + {typeInfo?.icon || '⚙️'}
- {provider.name} + {provider.name} {isDefault && ( Default )}
- {provider.type} + {provider.type}
-
- -
+
- - + + {/* Key row */} {isEditing ? ( -
-
- -
-
- setNewKey(e.target.value)} - className="pr-10" - /> - -
- - + {showKey ? : } +
+ +
) : ( -
-
- - - {provider.hasKey ? provider.keyMasked : 'No API key set'} +
+
+ + + {provider.hasKey ? shortenKeyDisplay(provider.keyMasked) : 'No API key set'} {provider.hasKey && ( - Configured + Configured )}
-
+
{!isDefault && ( - )} - -
diff --git a/src/pages/Settings/index.tsx b/src/pages/Settings/index.tsx index b738afe1f..49f7cc1d8 100644 --- a/src/pages/Settings/index.tsx +++ b/src/pages/Settings/index.tsx @@ -46,7 +46,7 @@ export function Settings() { }; return ( -
+

Settings