feat(delegate-task): use explicit high variant for unspecified-high category
- Update DEFAULT_CATEGORIES to use 'openai/gpt-5.4-high' directly instead of separate model + variant
- Add helper functions (isExplicitHighModel, getExplicitHighBaseModel) to preserve explicit high models during fuzzy matching
- Update category resolver to avoid collapsing explicit high models to base model + variant pair
- Update tests to verify explicit high model handling in both background and sync modes
- Update documentation examples to reflect new configuration
🤖 Generated with OhMyOpenCode assistance
This commit is contained in:
@@ -3,6 +3,14 @@ import { normalizeModel } from "../../shared/model-normalization"
|
||||
import { fuzzyMatchModel } from "../../shared/model-availability"
|
||||
import { transformModelForProvider } from "../../shared/provider-model-id-transform"
|
||||
|
||||
function isExplicitHighModel(model: string): boolean {
|
||||
return /(?:^|\/)[^/]+-high$/.test(model)
|
||||
}
|
||||
|
||||
function getExplicitHighBaseModel(model: string): string | null {
|
||||
return isExplicitHighModel(model) ? model.replace(/-high$/, "") : null
|
||||
}
|
||||
|
||||
|
||||
export function resolveModelForDelegateTask(input: {
|
||||
userModel?: string
|
||||
@@ -17,6 +25,8 @@ export function resolveModelForDelegateTask(input: {
|
||||
}
|
||||
|
||||
const categoryDefault = normalizeModel(input.categoryDefaultModel)
|
||||
const explicitHighBaseModel = categoryDefault ? getExplicitHighBaseModel(categoryDefault) : null
|
||||
const explicitHighModel = explicitHighBaseModel ? categoryDefault : undefined
|
||||
if (categoryDefault) {
|
||||
if (input.availableModels.size === 0) {
|
||||
return { model: categoryDefault }
|
||||
@@ -26,6 +36,10 @@ export function resolveModelForDelegateTask(input: {
|
||||
const providerHint = parts.length >= 2 ? [parts[0]] : undefined
|
||||
const match = fuzzyMatchModel(categoryDefault, input.availableModels, providerHint)
|
||||
if (match) {
|
||||
if (isExplicitHighModel(categoryDefault) && match !== categoryDefault) {
|
||||
return { model: categoryDefault }
|
||||
}
|
||||
|
||||
return { model: match }
|
||||
}
|
||||
}
|
||||
@@ -45,12 +59,20 @@ export function resolveModelForDelegateTask(input: {
|
||||
const fullModel = `${provider}/${entry.model}`
|
||||
const match = fuzzyMatchModel(fullModel, input.availableModels, [provider])
|
||||
if (match) {
|
||||
if (explicitHighModel && entry.variant === "high" && match === explicitHighBaseModel) {
|
||||
return { model: explicitHighModel }
|
||||
}
|
||||
|
||||
return { model: match, variant: entry.variant }
|
||||
}
|
||||
}
|
||||
|
||||
const crossProviderMatch = fuzzyMatchModel(entry.model, input.availableModels)
|
||||
if (crossProviderMatch) {
|
||||
if (explicitHighModel && entry.variant === "high" && crossProviderMatch === explicitHighBaseModel) {
|
||||
return { model: explicitHighModel }
|
||||
}
|
||||
|
||||
return { model: crossProviderMatch, variant: entry.variant }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user