fix: raise featured Sonnet provider context windows

The featured Anthropic-compatible provider presets now advertise their Sonnet models as one-million-token windows so the desktop context form and runtime env match the requested provider limits. Regression assertions cover both preset display and runtime env generation.

Constraint: Only the two featured provider presets requested by the desktop settings flow should change.
Rejected: Change global Sonnet built-in default | would alter unrelated providers and custom models.
Confidence: high
Scope-risk: narrow
Directive: Do not lower these preset windows without checking provider-specific limits and the desktop settings preview.
Tested: bun test src/server/__tests__/provider-presets.test.ts src/server/__tests__/providers.test.ts
Tested: bun run check:server
Tested: agent-browser UI verification on http://127.0.0.1:49174 with backend http://127.0.0.1:49173
Not-tested: Live API requests against 接口AI or 胜算云.
This commit is contained in:
程序员阿江(Relakkes) 2026-05-05 17:28:16 +08:00
parent dfc7ee6f91
commit 4e20aac647
3 changed files with 6 additions and 4 deletions

View File

@ -101,10 +101,12 @@ describe('provider presets API', () => {
expect(jiekouai?.defaultModels.main).toBe('claude-sonnet-4-6')
expect(jiekouai?.defaultModels.opus).toBe('claude-opus-4-7')
expect(jiekouai?.defaultEnv?.ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES).toBe('none')
expect(jiekouai?.modelContextWindows?.['claude-sonnet-4-6']).toBe(1000000)
expect(shengsuanyun?.baseUrl).toBe('https://router.shengsuanyun.com/api')
expect(shengsuanyun?.authStrategy).toBe('auth_token')
expect(shengsuanyun?.defaultModels.main).toBe('anthropic/claude-sonnet-4.6')
expect(shengsuanyun?.defaultModels.haiku).toBe('anthropic/claude-haiku-4.5:thinking')
expect(shengsuanyun?.modelContextWindows?.['anthropic/claude-sonnet-4.6']).toBe(1000000)
})
test('configured presets can expose optional API key and promo metadata', () => {

View File

@ -462,7 +462,7 @@ describe('ProviderService', () => {
expect(env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe('1')
expect(env.CLAUDE_CODE_AUTO_COMPACT_WINDOW).toBeUndefined()
expect(JSON.parse(env.CLAUDE_CODE_MODEL_CONTEXT_WINDOWS)).toEqual({
'anthropic/claude-sonnet-4.6': 200000,
'anthropic/claude-sonnet-4.6': 1000000,
'anthropic/claude-haiku-4.5:thinking': 200000,
'anthropic/claude-opus-4.7': 1000000,
})
@ -472,7 +472,7 @@ describe('ProviderService', () => {
expect(runtimeEnv.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC).toBe('1')
expect(runtimeEnv.CLAUDE_CODE_AUTO_COMPACT_WINDOW).toBeUndefined()
expect(JSON.parse(runtimeEnv.CLAUDE_CODE_MODEL_CONTEXT_WINDOWS)).toEqual({
'anthropic/claude-sonnet-4.6': 200000,
'anthropic/claude-sonnet-4.6': 1000000,
'anthropic/claude-haiku-4.5:thinking': 200000,
'anthropic/claude-opus-4.7': 1000000,
})

View File

@ -136,7 +136,7 @@
"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES": "none"
},
"modelContextWindows": {
"claude-sonnet-4-6": 200000,
"claude-sonnet-4-6": 1000000,
"claude-haiku-4-5-20251001": 200000,
"claude-haiku-4-5": 200000,
"claude-opus-4-7": 1000000
@ -165,7 +165,7 @@
"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES": "none"
},
"modelContextWindows": {
"anthropic/claude-sonnet-4.6": 200000,
"anthropic/claude-sonnet-4.6": 1000000,
"anthropic/claude-haiku-4.5:thinking": 200000,
"anthropic/claude-opus-4.7": 1000000
}