mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-16 14:57:36 +08:00
fix: omit Codex model catalog for OpenAI groups
This commit is contained in:
@@ -315,8 +315,8 @@ let codexModelManifestRequestID = 0
|
||||
|
||||
const showCodexModelCatalog = computed(() =>
|
||||
props.show &&
|
||||
(activeClientTab.value === 'codex' ||
|
||||
(props.platform === 'openai' && activeClientTab.value === 'codex-ws'))
|
||||
props.platform !== 'openai' &&
|
||||
activeClientTab.value === 'codex'
|
||||
)
|
||||
|
||||
const codexModelCatalogPath = computed(() => {
|
||||
@@ -956,7 +956,6 @@ function generateOpenAIFiles(baseUrl: string, apiKey: string): FileConfig[] {
|
||||
model = "${model}"
|
||||
review_model = "${model}"
|
||||
${reasoningEffortLine}disable_response_storage = true
|
||||
model_catalog_json = "${CODEX_MODEL_CATALOG_CONFIG_PATH}"
|
||||
network_access = "enabled"
|
||||
windows_wsl_setup_acknowledged = true
|
||||
|
||||
@@ -1305,7 +1304,6 @@ function generateOpenAIWsFiles(baseUrl: string, apiKey: string): FileConfig[] {
|
||||
model = "${model}"
|
||||
review_model = "${model}"
|
||||
${reasoningEffortLine}disable_response_storage = true
|
||||
model_catalog_json = "${CODEX_MODEL_CATALOG_CONFIG_PATH}"
|
||||
network_access = "enabled"
|
||||
windows_wsl_setup_acknowledged = true
|
||||
|
||||
|
||||
@@ -941,21 +941,9 @@ describe('UseKeyModal', () => {
|
||||
expect(config).toContain('review_model = "gpt-5.5"')
|
||||
})
|
||||
|
||||
it('derives OpenAI Codex reasoning effort from the selected catalog descriptor', async () => {
|
||||
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({
|
||||
models: [
|
||||
{
|
||||
slug: 'glm-5.3',
|
||||
default_reasoning_level: 'none',
|
||||
supported_reasoning_levels: [{ effort: 'none' }]
|
||||
}
|
||||
]
|
||||
})
|
||||
}))
|
||||
|
||||
it('omits the Codex catalog for OpenAI in both transport modes and on both platforms', async () => {
|
||||
const fetchMock = vi.fn()
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
const wrapper = mount(UseKeyModal, {
|
||||
props: {
|
||||
show: true,
|
||||
@@ -975,13 +963,18 @@ describe('UseKeyModal', () => {
|
||||
}
|
||||
})
|
||||
|
||||
await wrapper.get('[data-testid="codex-model-catalog-fetch"]').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
const configToml = wrapper.findAll('pre code')
|
||||
.map((code) => code.text())
|
||||
.find((content) => content.includes('model_provider = "OpenAI"'))
|
||||
expect(configToml).toContain('model = "glm-5.3"')
|
||||
expect(configToml).not.toContain('model_reasoning_effort')
|
||||
for (const transport of ['keys.useKeyModal.cliTabs.codexCli', 'keys.useKeyModal.cliTabs.codexCliWs']) {
|
||||
await wrapper.findAll('button').find((button) => button.text().trim() === transport)!.trigger('click')
|
||||
for (const os of ['macOS / Linux', 'Windows']) {
|
||||
await wrapper.findAll('button').find((button) => button.text().trim() === os)!.trigger('click')
|
||||
const configToml = wrapper.findAll('pre code')
|
||||
.map((code) => code.text())
|
||||
.find((content) => content.includes('model_provider = "OpenAI"'))
|
||||
expect(configToml).toContain('model = "gpt-5.5"')
|
||||
expect(configToml).not.toContain('model_catalog_json')
|
||||
expect(wrapper.find('[data-testid="codex-model-catalog"]').exists()).toBe(false)
|
||||
}
|
||||
}
|
||||
expect(fetchMock).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user