fix(ui): fix profile switching and improve UX

- Add key prop to ProfileEditor to force remount on profile change

- Reset editorHasChanges on discard confirmation

- Add text-white to destructive dialog button

- Change OpenRouter default model to claude-opus-4.5
This commit is contained in:
kaitranntt
2025-12-21 01:20:57 -05:00
parent b790005c85
commit 86d992fce6
4 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
description: '349+ models from OpenAI, Anthropic, Google, Meta', description: '349+ models from OpenAI, Anthropic, Google, Meta',
baseUrl: OPENROUTER_BASE_URL, baseUrl: OPENROUTER_BASE_URL,
defaultProfileName: 'openrouter', defaultProfileName: 'openrouter',
defaultModel: 'anthropic/claude-sonnet-4', defaultModel: 'anthropic/claude-opus-4.5',
apiKeyPlaceholder: 'sk-or-...', apiKeyPlaceholder: 'sk-or-...',
apiKeyHint: 'Get your API key at openrouter.ai/keys', apiKeyHint: 'Get your API key at openrouter.ai/keys',
category: 'recommended', category: 'recommended',
+1 -1
View File
@@ -39,7 +39,7 @@ export function ConfirmDialog({
<AlertDialogCancel onClick={onCancel}>Cancel</AlertDialogCancel> <AlertDialogCancel onClick={onCancel}>Cancel</AlertDialogCancel>
<AlertDialogAction <AlertDialogAction
onClick={onConfirm} onClick={onConfirm}
className={variant === 'destructive' ? 'bg-red-600 hover:bg-red-700' : ''} className={variant === 'destructive' ? 'bg-red-600 hover:bg-red-700 text-white' : ''}
> >
{confirmText} {confirmText}
</AlertDialogAction> </AlertDialogAction>
+1 -1
View File
@@ -34,7 +34,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
badge: '349+ models', badge: '349+ models',
featured: true, featured: true,
icon: '/icons/openrouter.svg', icon: '/icons/openrouter.svg',
defaultModel: 'anthropic/claude-sonnet-4', defaultModel: 'anthropic/claude-opus-4.5',
requiresApiKey: true, requiresApiKey: true,
apiKeyPlaceholder: 'sk-or-...', apiKeyPlaceholder: 'sk-or-...',
apiKeyHint: 'Get your API key at openrouter.ai/keys', apiKeyHint: 'Get your API key at openrouter.ai/keys',
+2
View File
@@ -220,6 +220,7 @@ export function ApiPage() {
<div className="flex-1 flex flex-col min-w-0"> <div className="flex-1 flex flex-col min-w-0">
{selectedProfileData ? ( {selectedProfileData ? (
<ProfileEditor <ProfileEditor
key={selectedProfileData.name}
profileName={selectedProfileData.name} profileName={selectedProfileData.name}
onDelete={() => setDeleteConfirm(selectedProfileData.name)} onDelete={() => setDeleteConfirm(selectedProfileData.name)}
onHasChangesUpdate={setEditorHasChanges} onHasChangesUpdate={setEditorHasChanges}
@@ -266,6 +267,7 @@ export function ApiPage() {
confirmText="Discard & Switch" confirmText="Discard & Switch"
variant="destructive" variant="destructive"
onConfirm={() => { onConfirm={() => {
setEditorHasChanges(false);
setSelectedProfile(pendingSwitch); setSelectedProfile(pendingSwitch);
setPendingSwitch(null); setPendingSwitch(null);
}} }}