mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-17 18:13:43 +00:00
Merge pull request #1653 from minhbi245/feat/codex-fast-toggle
feat(ui): add codex fast service-tier toggle
This commit is contained in:
6 files changed
+113
-1
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
applyCodexEffortSuffix,
|
||||
applyCodexServiceTierSuffix,
|
||||
getCodexEffortDisplay,
|
||||
getCodexEffortVariants,
|
||||
getSelectableCodexEfforts,
|
||||
@@ -111,6 +112,40 @@ describe('codex effort helpers', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('applyCodexServiceTierSuffix', () => {
|
||||
it('adds the fast tier while preserving the effort suffix', () => {
|
||||
expect(applyCodexServiceTierSuffix('gpt-5.4-high', true)).toBe('gpt-5.4-high-fast');
|
||||
});
|
||||
|
||||
it('removes only the fast tier', () => {
|
||||
expect(applyCodexServiceTierSuffix('gpt-5.4-high-fast', false)).toBe('gpt-5.4-high');
|
||||
expect(applyCodexServiceTierSuffix('gpt-5.4-fast', false)).toBe('gpt-5.4');
|
||||
});
|
||||
|
||||
it('preserves routing prefixes', () => {
|
||||
expect(applyCodexServiceTierSuffix('codex/gpt-5.6-sol', true)).toBe('codex/gpt-5.6-sol-fast');
|
||||
});
|
||||
|
||||
it('is idempotent and safe on empty input', () => {
|
||||
expect(applyCodexServiceTierSuffix('gpt-5.4-fast', true)).toBe('gpt-5.4-fast');
|
||||
expect(applyCodexServiceTierSuffix('gpt-5.4', false)).toBe('gpt-5.4');
|
||||
expect(applyCodexServiceTierSuffix(undefined, true)).toBe('');
|
||||
expect(applyCodexServiceTierSuffix('', true)).toBe('');
|
||||
});
|
||||
|
||||
it('composes with applyCodexEffortSuffix in both orders', () => {
|
||||
expect(applyCodexEffortSuffix(applyCodexServiceTierSuffix('gpt-5.4', true), 'high')).toBe(
|
||||
'gpt-5.4-high-fast'
|
||||
);
|
||||
expect(applyCodexServiceTierSuffix(applyCodexEffortSuffix('gpt-5.4', 'high'), true)).toBe(
|
||||
'gpt-5.4-high-fast'
|
||||
);
|
||||
expect(
|
||||
applyCodexEffortSuffix(applyCodexServiceTierSuffix('gpt-5.4-high-fast', false), 'low')
|
||||
).toBe('gpt-5.4-low');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getSelectableCodexEfforts', () => {
|
||||
it('returns the explicit efforts list when provided', () => {
|
||||
expect(getSelectableCodexEfforts('xhigh', ['low', 'medium', 'high', 'xhigh'])).toEqual([
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildUiCatalog } from '@/lib/model-catalogs';
|
||||
|
||||
describe('buildUiCatalog codex tuning metadata merge', () => {
|
||||
it('preserves static codex effort and service-tier metadata when the live catalog omits them', () => {
|
||||
const merged = buildUiCatalog('codex', {
|
||||
provider: 'codex',
|
||||
displayName: 'Codex',
|
||||
defaultModel: 'gpt-5.6-sol',
|
||||
models: [{ id: 'gpt-5.6-sol', name: 'GPT-5.6 Sol' }],
|
||||
});
|
||||
|
||||
const model = merged?.models.find((entry) => entry.id === 'gpt-5.6-sol');
|
||||
expect(model?.codexMaxEffort).toBe('xhigh');
|
||||
expect(model?.codexEfforts).toEqual(['low', 'medium', 'high', 'xhigh']);
|
||||
expect(model?.codexServiceTiers).toEqual(['fast']);
|
||||
});
|
||||
|
||||
it('prefers live metadata over static when the live catalog provides it', () => {
|
||||
const merged = buildUiCatalog('codex', {
|
||||
provider: 'codex',
|
||||
displayName: 'Codex',
|
||||
defaultModel: 'gpt-5.6-sol',
|
||||
models: [{ id: 'gpt-5.6-sol', name: 'GPT-5.6 Sol', codexServiceTiers: [] }],
|
||||
});
|
||||
|
||||
const model = merged?.models.find((entry) => entry.id === 'gpt-5.6-sol');
|
||||
expect(model?.codexServiceTiers).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user