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',
baseUrl: OPENROUTER_BASE_URL,
defaultProfileName: 'openrouter',
defaultModel: 'anthropic/claude-sonnet-4',
defaultModel: 'anthropic/claude-opus-4.5',
apiKeyPlaceholder: 'sk-or-...',
apiKeyHint: 'Get your API key at openrouter.ai/keys',
category: 'recommended',
+1 -1
View File
@@ -39,7 +39,7 @@ export function ConfirmDialog({
<AlertDialogCancel onClick={onCancel}>Cancel</AlertDialogCancel>
<AlertDialogAction
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}
</AlertDialogAction>
+1 -1
View File
@@ -34,7 +34,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
badge: '349+ models',
featured: true,
icon: '/icons/openrouter.svg',
defaultModel: 'anthropic/claude-sonnet-4',
defaultModel: 'anthropic/claude-opus-4.5',
requiresApiKey: true,
apiKeyPlaceholder: 'sk-or-...',
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">
{selectedProfileData ? (
<ProfileEditor
key={selectedProfileData.name}
profileName={selectedProfileData.name}
onDelete={() => setDeleteConfirm(selectedProfileData.name)}
onHasChangesUpdate={setEditorHasChanges}
@@ -266,6 +267,7 @@ export function ApiPage() {
confirmText="Discard & Switch"
variant="destructive"
onConfirm={() => {
setEditorHasChanges(false);
setSelectedProfile(pendingSwitch);
setPendingSwitch(null);
}}