unify model selection

This commit is contained in:
weishu
2026-03-16 18:29:09 +08:00
parent 1f02bb7de1
commit 02c8e12e80
27 changed files with 454 additions and 41 deletions
+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, it } from 'vitest'
import { getSessionModelLabel } from './sessionModelLabel'
describe('getSessionModelLabel', () => {
it('prefers the explicit session model', () => {
expect(getSessionModelLabel({ model: 'gpt-5.4', modelMode: 'default' })).toEqual({
key: 'session.item.model',
value: 'gpt-5.4'
})
})
it('falls back to Claude model mode when no explicit model exists', () => {
expect(getSessionModelLabel({ modelMode: 'opus' })).toEqual({
key: 'session.item.modelMode',
value: 'Opus'
})
})
it('returns null when neither model nor mode is available', () => {
expect(getSessionModelLabel({})).toBeNull()
})
})