mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
feat: 解除 max/xhigh effort 级别的模型白名单限制
This commit is contained in:
@@ -274,3 +274,61 @@ describe('resolvePickerEffortPersistence', () => {
|
||||
expect(result).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
// ─── modelSupportsMaxEffort ────────────────────────────────────────────
|
||||
|
||||
describe('modelSupportsMaxEffort', () => {
|
||||
test('returns true for opus-4-7', async () => {
|
||||
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsMaxEffort('claude-opus-4-7-20250918')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for opus-4-6', async () => {
|
||||
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsMaxEffort('claude-opus-4-6-20250514')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for sonnet models', async () => {
|
||||
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsMaxEffort('claude-sonnet-4-6-20250514')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for haiku models', async () => {
|
||||
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsMaxEffort('claude-haiku-4-5-20251001')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for deepseek models', async () => {
|
||||
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsMaxEffort('deepseek-v4-pro')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for unknown models', async () => {
|
||||
const { modelSupportsMaxEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsMaxEffort('some-random-model')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
// ─── modelSupportsXhighEffort ──────────────────────────────────────────
|
||||
|
||||
describe('modelSupportsXhighEffort', () => {
|
||||
test('returns true for opus-4-7', async () => {
|
||||
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsXhighEffort('claude-opus-4-7-20250918')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for sonnet models', async () => {
|
||||
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsXhighEffort('claude-sonnet-4-6-20250514')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for haiku models', async () => {
|
||||
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsXhighEffort('claude-haiku-4-5-20251001')).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for unknown models', async () => {
|
||||
const { modelSupportsXhighEffort } = await import('src/utils/effort.js')
|
||||
expect(modelSupportsXhighEffort('some-random-model')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -67,51 +67,22 @@ export function modelSupportsEffort(model: string): boolean {
|
||||
return getAPIProvider() === 'firstParty'
|
||||
}
|
||||
|
||||
// @[MODEL LAUNCH]: Add the new model to the allowlist if it supports 'max' effort.
|
||||
// Per API docs, 'max' is Opus 4.6/4.7 only for public models — other models return an error.
|
||||
// However, DeepSeek V4 Pro also supports max effort when using Anthropic-compatible API.
|
||||
export function modelSupportsMaxEffort(model: string): boolean {
|
||||
const supported3P = get3PModelCapabilityOverride(model, 'max_effort')
|
||||
// Effort max/xhigh restrictions removed — all models that support effort
|
||||
// can now use these levels. API errors are the user's responsibility.
|
||||
export function modelSupportsMaxEffort(_model: string): boolean {
|
||||
const supported3P = get3PModelCapabilityOverride(_model, 'max_effort')
|
||||
if (supported3P !== undefined) {
|
||||
return supported3P
|
||||
}
|
||||
// Support DeepSeek V4 Pro specifically (Anthropic-compatible API)
|
||||
if (model.toLowerCase().includes('deepseek-v4-pro')) {
|
||||
return true
|
||||
}
|
||||
if (
|
||||
model.toLowerCase().includes('opus-4-7') ||
|
||||
model.toLowerCase().includes('opus-4-6')
|
||||
) {
|
||||
return true
|
||||
}
|
||||
if (process.env.USER_TYPE === 'ant' && resolveAntModel(model)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// @[MODEL LAUNCH]: Add the new model to the allowlist if it supports 'xhigh' effort.
|
||||
// 'xhigh' was introduced with Opus 4.7 as a level between 'high' and 'max'.
|
||||
export function modelSupportsXhighEffort(model: string): boolean {
|
||||
const supported3P = get3PModelCapabilityOverride(model, 'xhigh_effort')
|
||||
export function modelSupportsXhighEffort(_model: string): boolean {
|
||||
const supported3P = get3PModelCapabilityOverride(_model, 'xhigh_effort')
|
||||
if (supported3P !== undefined) {
|
||||
return supported3P
|
||||
}
|
||||
if (
|
||||
getAPIProvider() === 'openai' &&
|
||||
isChatGPTAuthMode() &&
|
||||
isChatGPTCodexReasoningModel(model)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
if (model.toLowerCase().includes('opus-4-7')) {
|
||||
return true
|
||||
}
|
||||
if (process.env.USER_TYPE === 'ant' && resolveAntModel(model)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function isEffortLevel(value: string): value is EffortLevel {
|
||||
|
||||
Reference in New Issue
Block a user