Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/ui/model-selector/model-selector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe('categorizeModels', () => {

const disabled = groups.find((g) => g.id === 'standard-disabled')
expect(disabled).toBeDefined()
expect(disabled!.label).toBeUndefined()
expect(disabled!.subtitle).toBeUndefined()
expect(disabled!.label).toBe('Standard Models')
expect(disabled!.subtitle).toBe('Not available in confidential chats.')
expect(disabled!.items).toHaveLength(1)
expect(disabled!.items[0].id).toBe('std-1')
expect(disabled!.items[0].disabled).toBe(true)
Expand All @@ -69,8 +69,8 @@ describe('categorizeModels', () => {

const disabled = groups.find((g) => g.id === 'confidential-disabled')
expect(disabled).toBeDefined()
expect(disabled!.label).toBeUndefined()
expect(disabled!.subtitle).toBeUndefined()
expect(disabled!.label).toBe('Confidential Models')
expect(disabled!.subtitle).toBe('Available only in confidential chats.')
expect(disabled!.items).toHaveLength(1)
expect(disabled!.items[0].id).toBe('conf-1')
expect(disabled!.items[0].disabled).toBe(true)
Expand Down
20 changes: 15 additions & 5 deletions src/components/ui/model-selector/model-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,24 @@ export const categorizeModels = (
if (custom.length > 0) {
groups.push({ id: 'custom', label: 'Custom Models', items: custom })
}
// Models disabled by an encryption mismatch are shown greyed out with no
// group heading or explanation (only one of these buckets is ever non-empty
// for a given chat, since the mismatch is one-directional).
// A chat is locked to its confidentiality mode, so the opposite-mode models
// are shown greyed out with a header explaining why. Only one of these
// buckets is ever non-empty for a given chat.
if (disabledStandard.length > 0) {
groups.push({ id: 'standard-disabled', items: disabledStandard })
groups.push({
id: 'standard-disabled',
label: 'Standard Models',
subtitle: 'Not available in confidential chats.',
items: disabledStandard,
})
}
if (disabledConfidential.length > 0) {
groups.push({ id: 'confidential-disabled', items: disabledConfidential })
groups.push({
id: 'confidential-disabled',
label: 'Confidential Models',
subtitle: 'Available only in confidential chats.',
items: disabledConfidential,
})
}

return groups
Expand Down
Loading