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