mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-04 00:42:14 +00:00
feat(codex): complete routed model catalogs
Codex treats the downloaded model catalog as a capability contract. Slug-only entries hide supported reasoning levels, can advertise invalid image inputs, and expose automatic or media-only models in the model picker. Generate complete route-aware metadata, preserve official manifests, filter non-agent models, and compute validators from the final catalog.
This commit is contained in:
12 files changed
+2420
-97
No files matched your search
@@ -16,10 +16,34 @@ describe('Codex models API', () => {
|
||||
})
|
||||
|
||||
it('fetches a manifest with the current API key without adding it to the catalog', async () => {
|
||||
const manifest = {
|
||||
models: [
|
||||
{
|
||||
slug: 'grok-4.6',
|
||||
default_reasoning_level: 'high',
|
||||
supported_reasoning_levels: [
|
||||
{ effort: 'low', description: 'Fast responses' },
|
||||
{ effort: 'xhigh', description: 'Extra-high reasoning depth' }
|
||||
],
|
||||
input_modalities: ['text', 'image'],
|
||||
model_messages: { instructions_template: 'Use the routed model.' }
|
||||
},
|
||||
{
|
||||
slug: 'deepseek-v4-pro',
|
||||
default_reasoning_level: 'high',
|
||||
supported_reasoning_levels: [
|
||||
{ effort: 'low', description: 'Fast responses' },
|
||||
{ effort: 'max', description: 'Maximum reasoning depth' }
|
||||
],
|
||||
input_modalities: ['text'],
|
||||
model_messages: { instructions_template: 'Use the routed model.' }
|
||||
}
|
||||
]
|
||||
}
|
||||
const fetchMock = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
status: 200,
|
||||
json: async () => ({ models: [{ slug: 'grok-4.6' }, { slug: 'deepseek-v4-pro' }] })
|
||||
json: async () => manifest
|
||||
})
|
||||
vi.stubGlobal('fetch', fetchMock)
|
||||
|
||||
@@ -35,6 +59,10 @@ describe('Codex models API', () => {
|
||||
})
|
||||
)
|
||||
expect(result.modelCount).toBe(2)
|
||||
expect(JSON.parse(result.content)).toEqual(manifest)
|
||||
expect(result.content).toContain('"effort": "xhigh"')
|
||||
expect(result.content).toContain('"input_modalities"')
|
||||
expect(result.content).toContain('"instructions_template"')
|
||||
expect(result.content).not.toContain('sk-user-test')
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user