Expose deepseek-chat in Telegram picker

---
Build: pass | Tests: FAIL — Tests  1 failed | 2028 passed (2029)
This commit is contained in:
Operator & Codex 2026-04-29 00:11:18 +02:00
parent a1634cbfbc
commit f28d883084
2 changed files with 95 additions and 0 deletions

View file

@ -1,6 +1,7 @@
import { describe, it, expect, beforeEach } from 'vitest';
import {
augmentPickerModels,
getTtsModeForChat,
setTtsModeForChat,
clearTtsOverride,
@ -108,3 +109,71 @@ describe('command context', () => {
}).not.toThrow();
});
});
describe('augmentPickerModels', () => {
it('adds deepseek-chat for the DeepSeek picker when catalog only has v4 models', () => {
const models = augmentPickerModels('deepseek', [
{
id: 'deepseek-v4-flash',
provider: 'deepseek',
parent: null,
name: 'deepseek-v4-flash',
context_length: null,
pricing_in: null,
pricing_out: null,
free_tier: false,
},
{
id: 'deepseek-v4-pro',
provider: 'deepseek',
parent: null,
name: 'deepseek-v4-pro',
context_length: null,
pricing_in: null,
pricing_out: null,
free_tier: false,
},
]);
expect(models.map((m) => m.id)).toEqual([
'deepseek-chat',
'deepseek-v4-flash',
'deepseek-v4-pro',
]);
});
it('does not duplicate deepseek-chat when it is already present', () => {
const models = augmentPickerModels('deepseek', [
{
id: 'deepseek-chat',
provider: 'deepseek',
parent: null,
name: 'deepseek-chat',
context_length: null,
pricing_in: null,
pricing_out: null,
free_tier: false,
},
]);
expect(models).toHaveLength(1);
expect(models[0]?.id).toBe('deepseek-chat');
});
it('leaves non-DeepSeek providers unchanged', () => {
const models = augmentPickerModels('openrouter', [
{
id: 'openai/o3',
provider: 'openrouter',
parent: 'openai',
name: 'openai/o3',
context_length: null,
pricing_in: null,
pricing_out: null,
free_tier: false,
},
]);
expect(models.map((m) => m.id)).toEqual(['openai/o3']);
});
});

View file

@ -102,6 +102,7 @@ import {
getModelCatalogSubProviderBuckets,
getFreeModels,
} from './model-catalog.js';
import type { ModelEntry } from './model-catalog.js';
const modelHashMap = new Map<string, string>();
@ -115,6 +116,30 @@ function registerModelHash(id: string): string {
return hash;
}
export function augmentPickerModels(
provider: string,
models: ModelEntry[],
): ModelEntry[] {
if (provider !== 'deepseek') return models;
const hasLegacyAlias = models.some((m) => m.id === 'deepseek-chat');
if (hasLegacyAlias) return models;
return [
{
id: 'deepseek-chat',
provider: 'deepseek',
parent: null,
name: 'deepseek-chat',
context_length: null,
pricing_in: null,
pricing_out: null,
free_tier: false,
},
...models,
];
}
export interface CommandContext {
queue: GroupQueue;
registeredGroups: () => Record<string, RegisteredGroup>;
@ -2491,6 +2516,7 @@ export async function handleModelCallback(
await ctxArg.answerCallbackQuery({ text: 'Database error' });
return;
}
models = augmentPickerModels(provider, models);
const kb = new InlineKeyboard();
for (const m of models.slice(0, 8)) {
const hash = registerModelHash(m.id);