- backend: 删除 gpt-5 / 5.1 / 5.1-codex / 5.1-codex-max / 5.1-codex-mini / 5.2-codex / 5.4-nano 的内置映射与 DefaultModels 条目 - backend: normalizeCodexModel 默认兜底由 gpt-5.1 改为 gpt-5.4,gpt-5.3-codex-spark 独立保留映射 - backend: 修复 isOpenAIGPT54Model 与 shouldAutoInjectPromptCacheKeyForCompat 对 claude / gpt-4o 的误判(之前依赖 gpt-5.1 作为非 GPT 族的隐式 sentinel,改后需要显式前缀守卫) - backend: 清理 billing_service 中已不可达的 fallback 价格与 switch 分支 - frontend: 从白名单、OpenCode 配置、预设映射中移除已下线模型 - 同步更新所有相关单测 Refs: #1758, parallels upstream #1759 but adds downstream guard fixes
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { nextTick } from 'vue'
|
|
|
|
vi.mock('vue-i18n', () => ({
|
|
useI18n: () => ({
|
|
t: (key: string) => key
|
|
})
|
|
}))
|
|
|
|
vi.mock('@/composables/useClipboard', () => ({
|
|
useClipboard: () => ({
|
|
copyToClipboard: vi.fn().mockResolvedValue(true)
|
|
})
|
|
}))
|
|
|
|
import UseKeyModal from '../UseKeyModal.vue'
|
|
|
|
describe('UseKeyModal', () => {
|
|
it('renders GPT-5.4 mini entry in OpenCode config', async () => {
|
|
const wrapper = mount(UseKeyModal, {
|
|
props: {
|
|
show: true,
|
|
apiKey: 'sk-test',
|
|
baseUrl: 'https://example.com/v1',
|
|
platform: 'openai'
|
|
},
|
|
global: {
|
|
stubs: {
|
|
BaseDialog: {
|
|
template: '<div><slot /><slot name="footer" /></div>'
|
|
},
|
|
Icon: {
|
|
template: '<span />'
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
const opencodeTab = wrapper.findAll('button').find((button) =>
|
|
button.text().includes('keys.useKeyModal.cliTabs.opencode')
|
|
)
|
|
|
|
expect(opencodeTab).toBeDefined()
|
|
await opencodeTab!.trigger('click')
|
|
await nextTick()
|
|
|
|
const codeBlock = wrapper.find('pre code')
|
|
expect(codeBlock.exists()).toBe(true)
|
|
expect(codeBlock.text()).toContain('"name": "GPT-5.4 Mini"')
|
|
expect(codeBlock.text()).not.toContain('"name": "GPT-5.4 Nano"')
|
|
})
|
|
})
|