mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 20:12:39 +08:00
feat: support Claude Sonnet 5.5
This commit is contained in:
@@ -235,6 +235,7 @@ const formatScopeName = (scope: string): string => {
|
||||
'claude-sonnet-4-6': 'CSon46',
|
||||
'claude-sonnet-4-5': 'CSon45',
|
||||
'claude-sonnet-4-5-thinking': 'CSon45T',
|
||||
'claude-sonnet-5-5': 'CSon55',
|
||||
'claude-sonnet-5': 'CSon5',
|
||||
// Gemini 2.5 系列
|
||||
'gemini-2.5-flash': 'G25F',
|
||||
|
||||
@@ -51,7 +51,7 @@ function makeAccount(overrides: Partial<Account>): Account {
|
||||
}
|
||||
|
||||
describe('AccountStatusIndicator', () => {
|
||||
it('Claude 5 模型限流时显示 Opus 和 Sonnet 的短别名', () => {
|
||||
it('Claude 5 系列模型限流时显示 Opus 和 Sonnet 的短别名', () => {
|
||||
const wrapper = mount(AccountStatusIndicator, {
|
||||
props: {
|
||||
account: makeAccount({
|
||||
@@ -64,6 +64,10 @@ describe('AccountStatusIndicator', () => {
|
||||
'claude-sonnet-5': {
|
||||
rate_limited_at: '2026-07-28T00:00:00Z',
|
||||
rate_limit_reset_at: '2099-07-28T00:00:00Z'
|
||||
},
|
||||
'claude-sonnet-5-5': {
|
||||
rate_limited_at: '2026-09-28T00:00:00Z',
|
||||
rate_limit_reset_at: '2099-09-28T00:00:00Z'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +82,7 @@ describe('AccountStatusIndicator', () => {
|
||||
|
||||
expect(wrapper.text()).toContain('COpus5')
|
||||
expect(wrapper.text()).toContain('CSon5')
|
||||
expect(wrapper.text()).toContain('CSon55')
|
||||
expect(wrapper.text()).not.toContain('claude-sonnet-5')
|
||||
})
|
||||
|
||||
|
||||
@@ -1914,6 +1914,19 @@ function generateOpenCodeConfig(platform: string, baseUrl: string, apiKey: strin
|
||||
xhigh: { effort: 'xhigh' },
|
||||
max: { effort: 'max' }
|
||||
}
|
||||
},
|
||||
'claude-sonnet-5-5': {
|
||||
name: 'Claude Sonnet 5.5',
|
||||
limit: { context: 1000000, output: 128000 },
|
||||
modalities: { input: ['text', 'image', 'pdf'], output: ['text'] },
|
||||
options: { thinking: { type: 'adaptive' }, effort: 'high' },
|
||||
variants: {
|
||||
low: { effort: 'low' },
|
||||
medium: { effort: 'medium' },
|
||||
high: { effort: 'high' },
|
||||
xhigh: { effort: 'xhigh' },
|
||||
max: { effort: 'max' }
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (platform === 'antigravity-claude') {
|
||||
|
||||
@@ -690,7 +690,7 @@ describe('UseKeyModal', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('exports Opus 5.5 only on the Anthropic provider with adaptive defaults', async () => {
|
||||
it('exports Claude 5.5 models on the Anthropic provider with adaptive defaults', async () => {
|
||||
const wrapper = mount(UseKeyModal, {
|
||||
props: { show: true, apiKey: 'sk-test', baseUrl: 'https://example.com/v1', platform: 'anthropic' },
|
||||
global: { stubs: { BaseDialog: { template: '<div><slot /><slot name="footer" /></div>' }, Icon: { template: '<span />' } } }
|
||||
@@ -699,11 +699,15 @@ describe('UseKeyModal', () => {
|
||||
expect(tab).toBeDefined()
|
||||
await tab!.trigger('click')
|
||||
await nextTick()
|
||||
const model = JSON.parse(wrapper.find('pre code').text()).provider.anthropic.models['claude-opus-5-5']
|
||||
expect(model.limit).toEqual({ context: 1000000, output: 128000 })
|
||||
expect(model.options).toEqual({ thinking: { type: 'adaptive' }, effort: 'medium' })
|
||||
expect(model.variants.xhigh.effort).toBe('xhigh')
|
||||
expect(model.variants).not.toHaveProperty('none')
|
||||
const models = JSON.parse(wrapper.find('pre code').text()).provider.anthropic.models
|
||||
expect(models['claude-opus-5-5'].limit).toEqual({ context: 1000000, output: 128000 })
|
||||
expect(models['claude-opus-5-5'].options).toEqual({ thinking: { type: 'adaptive' }, effort: 'medium' })
|
||||
expect(models['claude-opus-5-5'].variants.xhigh.effort).toBe('xhigh')
|
||||
expect(models['claude-opus-5-5'].variants).not.toHaveProperty('none')
|
||||
expect(models['claude-sonnet-5-5'].limit).toEqual({ context: 1000000, output: 128000 })
|
||||
expect(models['claude-sonnet-5-5'].options).toEqual({ thinking: { type: 'adaptive' }, effort: 'high' })
|
||||
expect(models['claude-sonnet-5-5'].variants.xhigh.effort).toBe('xhigh')
|
||||
expect(models['claude-sonnet-5-5'].variants).not.toHaveProperty('none')
|
||||
})
|
||||
|
||||
it('renders Claude Fable 5 OpenCode config with adaptive thinking', async () => {
|
||||
|
||||
@@ -54,10 +54,21 @@ describe('useModelWhitelist', () => {
|
||||
expect(getModelsByPlatform('antigravity')).toContain('claude-fable-5')
|
||||
expect(getModelsByPlatform('claude')).toContain('claude-opus-5-5')
|
||||
expect(getModelsByPlatform('antigravity')).not.toContain('claude-opus-5-5')
|
||||
expect(getModelsByPlatform('claude')).toContain('claude-sonnet-5-5')
|
||||
expect(getModelsByPlatform('antigravity')).not.toContain('claude-sonnet-5-5')
|
||||
expect(getModelsByPlatform('claude')).toContain('claude-opus-4-8')
|
||||
expect(getModelsByPlatform('antigravity')).toContain('claude-opus-4-8')
|
||||
})
|
||||
|
||||
it('Claude Sonnet 5.5 预设使用各平台的官方模型 ID', () => {
|
||||
expect(getPresetMappingsByPlatform('claude')).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ label: 'Sonnet 5.5', from: 'claude-sonnet-5-5', to: 'claude-sonnet-5-5' })
|
||||
]))
|
||||
expect(getPresetMappingsByPlatform('bedrock')).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ label: 'Sonnet 5.5', from: 'claude-sonnet-5-5', to: 'global.anthropic.claude-sonnet-5-5' })
|
||||
]))
|
||||
})
|
||||
|
||||
it('xAI 模型列表包含 Grok 4.5 官方模型和别名', () => {
|
||||
const models = getModelsByPlatform('grok')
|
||||
|
||||
|
||||
@@ -36,8 +36,9 @@ export const claudeModels = [
|
||||
'claude-opus-4-8',
|
||||
'claude-opus-5-5',
|
||||
'claude-opus-5',
|
||||
'claude-sonnet-4-6',
|
||||
'claude-sonnet-5-5',
|
||||
'claude-sonnet-5',
|
||||
'claude-sonnet-4-6',
|
||||
'claude-fable-5-1',
|
||||
'claude-fable-5'
|
||||
]
|
||||
@@ -283,6 +284,7 @@ export const allModels = allModelsList.map(m => ({ value: m, label: m }))
|
||||
const anthropicPresetMappings = [
|
||||
{ label: 'Fable 5.1', from: 'claude-fable-5-1', to: 'claude-fable-5-1', color: 'bg-rose-100 text-rose-700 hover:bg-rose-200 dark:bg-rose-900/30 dark:text-rose-400' },
|
||||
{ label: 'Fable 5', from: 'claude-fable-5', to: 'claude-fable-5', color: 'bg-rose-100 text-rose-700 hover:bg-rose-200 dark:bg-rose-900/30 dark:text-rose-400' },
|
||||
{ label: 'Sonnet 5.5', from: 'claude-sonnet-5-5', to: 'claude-sonnet-5-5', color: 'bg-indigo-100 text-indigo-700 hover:bg-indigo-200 dark:bg-indigo-900/30 dark:text-indigo-400' },
|
||||
{ label: 'Sonnet 5', from: 'claude-sonnet-5', to: 'claude-sonnet-5', color: 'bg-indigo-100 text-indigo-700 hover:bg-indigo-200 dark:bg-indigo-900/30 dark:text-indigo-400' },
|
||||
{ label: 'Sonnet 4', from: 'claude-sonnet-4-20250514', to: 'claude-sonnet-4-20250514', color: 'bg-blue-100 text-blue-700 hover:bg-blue-200 dark:bg-blue-900/30 dark:text-blue-400' },
|
||||
{ label: 'Sonnet 4.5', from: 'claude-sonnet-4-5-20250929', to: 'claude-sonnet-4-5-20250929', color: 'bg-indigo-100 text-indigo-700 hover:bg-indigo-200 dark:bg-indigo-900/30 dark:text-indigo-400' },
|
||||
@@ -395,6 +397,7 @@ const bedrockPresetMappings = [
|
||||
{ label: 'Opus 4.7', from: 'claude-opus-4-7', to: 'us.anthropic.claude-opus-4-7-v1', color: 'bg-pink-100 text-pink-700 hover:bg-pink-200 dark:bg-pink-900/30 dark:text-pink-400' },
|
||||
{ label: 'Opus 4.8', from: 'claude-opus-4-8', to: 'us.anthropic.claude-opus-4-8-v1', color: 'bg-pink-100 text-pink-700 hover:bg-pink-200 dark:bg-pink-900/30 dark:text-pink-400' },
|
||||
{ label: 'Opus 5', from: 'claude-opus-5', to: 'us.anthropic.claude-opus-5-v1', color: 'bg-pink-100 text-pink-700 hover:bg-pink-200 dark:bg-pink-900/30 dark:text-pink-400' },
|
||||
{ label: 'Sonnet 5.5', from: 'claude-sonnet-5-5', to: 'global.anthropic.claude-sonnet-5-5', color: 'bg-indigo-100 text-indigo-700 hover:bg-indigo-200 dark:bg-indigo-900/30 dark:text-indigo-400' },
|
||||
{ label: 'Sonnet 5', from: 'claude-sonnet-5', to: 'us.anthropic.claude-sonnet-5-v1', color: 'bg-indigo-100 text-indigo-700 hover:bg-indigo-200 dark:bg-indigo-900/30 dark:text-indigo-400' },
|
||||
{ label: 'Sonnet 4.6', from: 'claude-sonnet-4-6', to: 'us.anthropic.claude-sonnet-4-6', color: 'bg-cyan-100 text-cyan-700 hover:bg-cyan-200 dark:bg-cyan-900/30 dark:text-cyan-400' },
|
||||
{ label: 'Opus 4.5', from: 'claude-opus-4-5-thinking', to: 'us.anthropic.claude-opus-4-5-20251101-v1:0', color: 'bg-pink-100 text-pink-700 hover:bg-pink-200 dark:bg-pink-900/30 dark:text-pink-400' },
|
||||
|
||||
Reference in New Issue
Block a user