mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(frontend): consolidate session picker navigation and remote project loading
This commit is contained in:
1 parent
81fb2d4033
commit
52aeb7780f
42 files changed
+1486
-769
No files matched your search
@@ -633,3 +633,70 @@ describe('ModelQuickSelect context strip', () => {
|
||||
expect(screen.queryByTestId('context-usage-strip')).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('ModelQuickSelect model descriptions', () => {
|
||||
const limitedProviders: Provider[] = [
|
||||
{
|
||||
id: 'anthropic',
|
||||
name: 'Anthropic',
|
||||
models: [
|
||||
{
|
||||
id: 'claude-sonnet-4',
|
||||
key: 'claude-sonnet-4',
|
||||
name: 'Claude Sonnet 4',
|
||||
released: 0,
|
||||
free: false,
|
||||
limit: { context: 200000, output: 8192 },
|
||||
},
|
||||
{
|
||||
id: 'claude-opus-5-5',
|
||||
key: 'claude-opus-5-5',
|
||||
name: 'Claude Opus 5.5',
|
||||
released: 0,
|
||||
free: false,
|
||||
limit: { context: 1000000, output: 8192 },
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
function selectModel(modelID: string) {
|
||||
const modelState = { favorite: [], recent: [], variant: {} }
|
||||
mocks.useModelSelection.mockReturnValue({
|
||||
model: { providerID: 'anthropic', modelID },
|
||||
modelString: `anthropic/${modelID}`,
|
||||
info: undefined,
|
||||
activeAgent: null,
|
||||
recentModels: [],
|
||||
favoriteModels: [],
|
||||
configured: null,
|
||||
modelState,
|
||||
setModel: vi.fn(),
|
||||
setActiveAgent: vi.fn(),
|
||||
toggleFavorite: vi.fn(),
|
||||
removeRecentModel: vi.fn(),
|
||||
isModelReady: true,
|
||||
})
|
||||
mocks.useModelSections.mockReturnValue({
|
||||
providers: limitedProviders,
|
||||
sections: buildModelSections(limitedProviders, modelState, null),
|
||||
defaultModel: null,
|
||||
modelState,
|
||||
isLoading: false,
|
||||
})
|
||||
}
|
||||
|
||||
it('formats the context limit like the context strip', () => {
|
||||
selectModel('claude-sonnet-4')
|
||||
render(<ModelQuickSelect open />)
|
||||
|
||||
expect(screen.getByText('Anthropic · 200k context', { selector: 'p' })).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('formats million-token limits without a trailing decimal', () => {
|
||||
selectModel('claude-opus-5-5')
|
||||
render(<ModelQuickSelect open />)
|
||||
|
||||
expect(screen.getByText('Anthropic · 1M context', { selector: 'p' })).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -472,8 +472,7 @@ export function ModelQuickSelect({
|
||||
const getDescription = (item: ModelListItem) => {
|
||||
const context = item.model?.limit?.context
|
||||
if (context) {
|
||||
const formattedContext = context >= 1000000 ? `${(context / 1000000).toFixed(1)}M` : context.toLocaleString()
|
||||
return `${item.providerName} · ${formattedContext} context`
|
||||
return `${item.providerName} · ${formatCompactTokens(context)} context`
|
||||
}
|
||||
|
||||
return item.providerName
|
||||
|
||||
Reference in new issue
Block a user