mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(gemini): support mid-session model change (#379)
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { getModelOptionsForFlavor, getNextModelForFlavor } from './modelOptions'
|
||||
|
||||
describe('getModelOptionsForFlavor', () => {
|
||||
it('returns Gemini model options for gemini flavor', () => {
|
||||
const options = getModelOptionsForFlavor('gemini')
|
||||
expect(options[0]).toEqual({ value: null, label: 'Default' })
|
||||
expect(options.some((o) => o.value === 'gemini-3-flash-preview')).toBe(true)
|
||||
expect(options.some((o) => o.value === 'gemini-2.5-flash')).toBe(true)
|
||||
})
|
||||
|
||||
it('returns Claude model options for claude flavor', () => {
|
||||
const options = getModelOptionsForFlavor('claude')
|
||||
expect(options[0]).toEqual({ value: null, label: 'Auto' })
|
||||
expect(options.some((o) => o.value === 'sonnet')).toBe(true)
|
||||
expect(options.some((o) => o.value === 'opus')).toBe(true)
|
||||
})
|
||||
|
||||
it('includes custom Gemini model from env/config in options', () => {
|
||||
const options = getModelOptionsForFlavor('gemini', 'gemini-custom-experiment')
|
||||
expect(options.some((o) => o.value === 'gemini-custom-experiment')).toBe(true)
|
||||
})
|
||||
|
||||
it('does not duplicate a preset Gemini model', () => {
|
||||
const options = getModelOptionsForFlavor('gemini', 'gemini-2.5-flash')
|
||||
const flashCount = options.filter((o) => o.value === 'gemini-2.5-flash').length
|
||||
expect(flashCount).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getNextModelForFlavor', () => {
|
||||
it('cycles Gemini models', () => {
|
||||
const next = getNextModelForFlavor('gemini', null)
|
||||
expect(next).not.toBeNull()
|
||||
})
|
||||
|
||||
it('cycles Claude models', () => {
|
||||
const next = getNextModelForFlavor('claude', null)
|
||||
expect(next).not.toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user