mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
fix(opencode): show each OpenCode v2 model's real effort options, with one Default (#2439)
* fix(web): drop provider-default entry from dynamic reasoning effort options * fix(cli): support OpenCode v2 /api/model variant lookup and Basic auth
This commit is contained in:
@@ -72,6 +72,31 @@ describe('getCodexComposerReasoningEffortOptions', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('drops provider-default entries from dynamic options so Default is not duplicated', () => {
|
||||
expect(getCodexComposerReasoningEffortOptions('default', 'opencode', [
|
||||
{ value: 'low', name: 'Low' },
|
||||
{ value: 'high', name: 'High' },
|
||||
{ value: 'max', name: 'Max' },
|
||||
{ value: 'default', name: 'Default' }
|
||||
])).toEqual([
|
||||
{ value: null, label: 'Default' },
|
||||
{ value: 'low', label: 'Low' },
|
||||
{ value: 'high', label: 'High' },
|
||||
{ value: 'max', label: 'Max' }
|
||||
])
|
||||
|
||||
expect(getCodexComposerReasoningEffortOptions('', 'dsh', [
|
||||
{ value: '', name: 'Provider default' },
|
||||
{ value: 'Default', name: 'Default' },
|
||||
{ value: 'low', name: 'Low' },
|
||||
{ value: 'high', name: 'High' }
|
||||
])).toEqual([
|
||||
{ value: null, label: 'Default' },
|
||||
{ value: 'low', label: 'Low' },
|
||||
{ value: 'high', label: 'High' }
|
||||
])
|
||||
})
|
||||
|
||||
it('preserves unsupported current OpenCode values in the dropdown', () => {
|
||||
expect(getCodexComposerReasoningEffortOptions('high', 'opencode', [
|
||||
{ value: 'low', name: 'Low' },
|
||||
|
||||
@@ -47,7 +47,10 @@ function buildDynamicReasoningEffortOptions(
|
||||
currentEffort: string | null,
|
||||
dynamicOptions: ComposerReasoningEffortSourceOption[]
|
||||
): CodexComposerReasoningEffortOption[] {
|
||||
const optionValues = new Set(dynamicOptions.map((option) => option.value))
|
||||
const filteredOptions = dynamicOptions.filter(
|
||||
(option) => normalizeCodexComposerReasoningEffort(option.value) !== null
|
||||
)
|
||||
const optionValues = new Set(filteredOptions.map((option) => option.value))
|
||||
const options: CodexComposerReasoningEffortOption[] = [
|
||||
{ value: null, label: 'Default' }
|
||||
]
|
||||
@@ -59,7 +62,7 @@ function buildDynamicReasoningEffortOptions(
|
||||
})
|
||||
}
|
||||
|
||||
options.push(...dynamicOptions.map((option) => ({
|
||||
options.push(...filteredOptions.map((option) => ({
|
||||
value: option.value,
|
||||
label: option.name ?? formatCodexReasoningEffortLabel(option.value)
|
||||
})))
|
||||
|
||||
Reference in New Issue
Block a user