feat(model-aliases): restore Fast service-tier option
- enable Fast for Codex API, OpenAI-compatible, and Codex OAuth sources - apply service_tier=priority as an independent payload override - support Fast-only and reasoning-effort combinations - disable Fast until a supported model source is selected
This commit is contained in:
1 parent
708a834e24
commit
cff6a21974
9 files changed
+443
-112
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, test } from 'bun:test';
|
||||
import {
|
||||
combineModelAliasEntries,
|
||||
combineModelAliasSources,
|
||||
defaultModelAlias,
|
||||
thinkingAliasSourceKindLabel,
|
||||
@@ -7,9 +8,11 @@ import {
|
||||
} from '../src/pages/ThinkingAliasesPage';
|
||||
|
||||
describe('模型别名默认名称', () => {
|
||||
test('按思考强度生成可编辑的默认名称', () => {
|
||||
expect(defaultModelAlias('gpt-5.6-sol', 'XHigh')).toBe('gpt-5.6-sol-xhigh');
|
||||
expect(defaultModelAlias('gpt-5.6-sol', '')).toBe('gpt-5.6-sol-alias');
|
||||
test('按思考强度和 Fast 选项生成可编辑的默认名称', () => {
|
||||
expect(defaultModelAlias('gpt-5.6-sol', 'XHigh', false)).toBe('gpt-5.6-sol-xhigh');
|
||||
expect(defaultModelAlias('gpt-5.6-sol', '', true)).toBe('gpt-5.6-sol-fast');
|
||||
expect(defaultModelAlias('gpt-5.6-sol', 'xhigh', true)).toBe('gpt-5.6-sol-xhigh-fast');
|
||||
expect(defaultModelAlias('gpt-5.6-sol', '', false)).toBe('gpt-5.6-sol-alias');
|
||||
});
|
||||
|
||||
test('默认别名与现有模型重名时递增数字后缀', () => {
|
||||
@@ -22,6 +25,38 @@ describe('模型别名默认名称', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('统一模型别名列表', () => {
|
||||
test('同一个别名可同时显示思考强度和 Fast', () => {
|
||||
const identity = {
|
||||
sourceModel: 'gpt-5.6-sol',
|
||||
alias: 'gpt-5.6-sol-xhigh-fast',
|
||||
provider: 'Codex OAuth',
|
||||
kind: 'codex-oauth',
|
||||
oauthChannel: 'codex',
|
||||
};
|
||||
const entries = combineModelAliasEntries(
|
||||
[{ ...identity, effort: 'xhigh' }],
|
||||
[{ ...identity, serviceTier: 'priority' }],
|
||||
);
|
||||
|
||||
expect(entries).toHaveLength(1);
|
||||
expect(entries[0]).toMatchObject({ effort: 'xhigh', serviceTier: 'priority' });
|
||||
});
|
||||
|
||||
test('Fast-only 别名仍会显示为独立条目', () => {
|
||||
const entries = combineModelAliasEntries([], [{
|
||||
sourceModel: 'gpt-5.6-sol',
|
||||
alias: 'gpt-5.6-sol-fast',
|
||||
serviceTier: 'priority',
|
||||
provider: 'Codex OAuth',
|
||||
kind: 'codex-oauth',
|
||||
oauthChannel: 'codex',
|
||||
}]);
|
||||
|
||||
expect(entries[0]).toMatchObject({ effort: null, serviceTier: 'priority' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('思考别名来源', () => {
|
||||
test('区分同名模型的接入来源', () => {
|
||||
expect(thinkingAliasSourceKindLabel('codex-oauth')).toBe('Codex OAuth');
|
||||
@@ -44,13 +79,16 @@ describe('思考别名来源', () => {
|
||||
{ ...baseSource, id: 'plain', model: 'plain-model' },
|
||||
],
|
||||
[{ ...baseSource, id: 'reasoning', reasoningLevels: ['low', 'high'] }],
|
||||
[{ ...baseSource, id: 'reasoning', reasoningLevels: ['low', 'high'] }],
|
||||
);
|
||||
|
||||
expect(sources).toHaveLength(2);
|
||||
expect(sources.find((source) => source.id === 'reasoning')).toMatchObject({
|
||||
supportsReasoning: true,
|
||||
supportsFast: true,
|
||||
reasoningLevels: ['low', 'high'],
|
||||
});
|
||||
expect(sources.find((source) => source.id === 'plain')?.supportsReasoning).toBe(false);
|
||||
expect(sources.find((source) => source.id === 'plain')?.supportsFast).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user