mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix claude model option merging (#726)
This commit is contained in:
@@ -16,6 +16,35 @@ describe('getModelOptionsForFlavor', () => {
|
||||
expect(options.some((o) => o.value === 'opus')).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps Claude presets when explicit options only include Sonnet models', () => {
|
||||
const options = getModelOptionsForFlavor('claude', null, [
|
||||
{ value: null, label: 'Default' },
|
||||
{ value: 'sonnet', label: 'Sonnet' },
|
||||
{ value: 'sonnet[1m]', label: 'Sonnet 1M' }
|
||||
])
|
||||
expect(options).toEqual([
|
||||
{ value: null, label: 'Default' },
|
||||
{ value: 'sonnet', label: 'Sonnet' },
|
||||
{ value: 'sonnet[1m]', label: 'Sonnet 1M' },
|
||||
{ value: 'opus', label: 'Opus' },
|
||||
{ value: 'opus[1m]', label: 'Opus 1M' }
|
||||
])
|
||||
})
|
||||
|
||||
it('adds non-preset Claude options without hiding Opus presets', () => {
|
||||
const options = getModelOptionsForFlavor('claude', null, [
|
||||
{ value: 'claude-opus-4-1-20250805', label: 'Claude Opus 4.1' }
|
||||
])
|
||||
expect(options).toEqual([
|
||||
{ value: null, label: 'Default' },
|
||||
{ value: 'claude-opus-4-1-20250805', label: 'Claude Opus 4.1' },
|
||||
{ value: 'sonnet', label: 'Sonnet' },
|
||||
{ value: 'sonnet[1m]', label: 'Sonnet 1M' },
|
||||
{ value: 'opus', label: 'Opus' },
|
||||
{ value: 'opus[1m]', label: 'Opus 1M' }
|
||||
])
|
||||
})
|
||||
|
||||
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)
|
||||
@@ -94,6 +123,14 @@ describe('getNextModelForFlavor', () => {
|
||||
expect(next).not.toBeNull()
|
||||
})
|
||||
|
||||
it('cycles through Claude presets when explicit options only include Sonnet models', () => {
|
||||
const next = getNextModelForFlavor('claude', 'sonnet[1m]', [
|
||||
{ value: 'sonnet', label: 'Sonnet' },
|
||||
{ value: 'sonnet[1m]', label: 'Sonnet 1M' }
|
||||
])
|
||||
expect(next).toBe('opus')
|
||||
})
|
||||
|
||||
it('cycles explicit model options', () => {
|
||||
const next = getNextModelForFlavor('codex', 'gpt-5.5', [
|
||||
{ value: 'gpt-5.5', label: 'GPT-5.5' },
|
||||
|
||||
Reference in New Issue
Block a user