fix(chat-web): select default model instead of first model

- Update chat store to find model with isDefault: true
- Fix model selection in chat page and spaces page
- Falls back to first model if no default is set

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Till-JS 2025-11-29 15:18:53 +01:00
parent 6150347c2a
commit 24eafc5430
5 changed files with 26 additions and 4 deletions

View file

@ -74,6 +74,12 @@
'M12 2L21.5 7.5V16.5L12 22L2.5 16.5V7.5L12 2Z',
waves:
'M2 12C2 12 5 8 9 8C13 8 15 12 15 12C15 12 17 16 21 16M2 17C2 17 5 13 9 13C13 13 15 17 15 17C15 17 17 21 21 21M2 7C2 7 5 3 9 3C13 3 15 7 15 7C15 7 17 11 21 11',
// User menu icons
user: 'M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z',
settings:
'M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z',
logout:
'M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1',
};
function getIcon(iconName: string) {

View file

@ -125,6 +125,16 @@
return 'href' in element;
}
// Truncate email for display (show first part before @, max 12 chars)
function truncateEmail(email: string, maxLength = 12): string {
const atIndex = email.indexOf('@');
const localPart = atIndex > 0 ? email.substring(0, atIndex) : email;
if (localPart.length <= maxLength) {
return localPart;
}
return localPart.substring(0, maxLength) + '…';
}
// Local state for uncontrolled mode
let internalSidebarMode = $state(false);
let internalCollapsed = $state(false);
@ -454,7 +464,7 @@
},
]}
direction="down"
label={userEmail}
label={truncateEmail(userEmail)}
icon="user"
/>
{:else if onLogout && showLogout}