mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 18:15:23 +00:00
feat(novita): add Novita AI provider preset
- Add novita preset with OpenAI-compatible endpoint - Default model: deepseek/deepseek-v3.2 - Endpoint: https://api.novita.ai/openai - API key via NOVITA_API_KEY env var
This commit is contained in:
1 parent
59a2eaf1c6
commit
a1a8cad2b3
2 files changed
+50
No files matched your search
@@ -21,6 +21,7 @@ export const PROVIDER_PRESET_IDS = [
|
|||||||
'deepseek',
|
'deepseek',
|
||||||
'qwen',
|
'qwen',
|
||||||
'ollama-cloud',
|
'ollama-cloud',
|
||||||
|
'novita',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type ProviderPresetId = (typeof PROVIDER_PRESET_IDS)[number];
|
export type ProviderPresetId = (typeof PROVIDER_PRESET_IDS)[number];
|
||||||
@@ -254,6 +255,20 @@ const RAW_PROVIDER_PRESET_DEFINITIONS: readonly ProviderPresetDefinition[] = [
|
|||||||
badge: 'Cloud',
|
badge: 'Cloud',
|
||||||
icon: '/icons/ollama.svg',
|
icon: '/icons/ollama.svg',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'novita',
|
||||||
|
name: 'Novita AI',
|
||||||
|
description: 'OpenAI-compatible API (Llama, Mistral, Qwen, and more)',
|
||||||
|
baseUrl: 'https://api.novita.ai/openai',
|
||||||
|
defaultProfileName: 'novita',
|
||||||
|
defaultModel: 'deepseek/deepseek-v3.2',
|
||||||
|
apiKeyPlaceholder: 'YOUR_NOVITA_API_KEY',
|
||||||
|
apiKeyHint: 'Get your API key at novita.ai',
|
||||||
|
category: 'alternative',
|
||||||
|
requiresApiKey: true,
|
||||||
|
badge: 'OpenAI-compatible',
|
||||||
|
icon: '/icons/novita.svg',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function clonePresetDefinition(preset: ProviderPresetDefinition): ProviderPresetDefinition {
|
function clonePresetDefinition(preset: ProviderPresetDefinition): ProviderPresetDefinition {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { describe, expect, it } from 'bun:test';
|
||||||
|
import { getPresetById, isValidPresetId } from '../../../src/api/services/provider-presets';
|
||||||
|
|
||||||
|
describe('provider-presets-novita', () => {
|
||||||
|
it('resolves novita preset id', () => {
|
||||||
|
const preset = getPresetById('novita');
|
||||||
|
expect(preset?.id).toBe('novita');
|
||||||
|
expect(preset?.baseUrl).toBe('https://api.novita.ai/openai');
|
||||||
|
expect(preset?.defaultProfileName).toBe('novita');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('resolves novita preset with expected model IDs', () => {
|
||||||
|
const preset = getPresetById('novita');
|
||||||
|
expect(preset?.defaultModel).toBe('deepseek/deepseek-v3.2');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('validates novita preset requires API key', () => {
|
||||||
|
const preset = getPresetById('novita');
|
||||||
|
expect(preset?.requiresApiKey).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('treats novita as a valid preset id', () => {
|
||||||
|
expect(isValidPresetId('novita')).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles whitespace in novita preset id', () => {
|
||||||
|
const preset = getPresetById(' novita ');
|
||||||
|
expect(preset?.id).toBe('novita');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles uppercase novita preset id', () => {
|
||||||
|
const preset = getPresetById('NOVITA');
|
||||||
|
expect(preset?.id).toBe('novita');
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in new issue
Block a user