mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 14:16:16 +00:00
Merge pull request #951 from kaitranntt/kai/feat/765-huggingface-inference-providers
feat: add Hugging Face API profile preset
This commit is contained in:
10 files changed
+158
-4
No files matched your search
@@ -157,6 +157,7 @@ export function ProfileCreateDialog({
|
||||
opusModel: preset.defaultModel,
|
||||
sonnetModel: preset.defaultModel,
|
||||
haikuModel: preset.defaultModel,
|
||||
target: preset.defaultTarget ?? 'claude',
|
||||
});
|
||||
},
|
||||
[reset]
|
||||
|
||||
@@ -47,6 +47,7 @@ describe('ProfileCreateDialog', () => {
|
||||
expect(screen.getByText('More Presets')).toBeInTheDocument();
|
||||
expect(screen.getByText('Local Runtimes')).toBeInTheDocument();
|
||||
expect(screen.getByText('Alibaba Coding Plan')).toBeVisible();
|
||||
expect(screen.getByText('Hugging Face')).toBeVisible();
|
||||
expect(document.body.querySelectorAll('.overflow-x-auto')).toHaveLength(2);
|
||||
|
||||
const customButton = screen.getByRole('button', { name: /Custom Endpoint/i });
|
||||
@@ -74,4 +75,27 @@ describe('ProfileCreateDialog', () => {
|
||||
expect(screen.getByDisplayValue('http://localhost:11434')).toBeInTheDocument();
|
||||
expect(screen.getByText('Local Runtimes')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('steers the Hugging Face preset to the droid target by default', async () => {
|
||||
render(
|
||||
<ProfileCreateDialog
|
||||
open
|
||||
onOpenChange={vi.fn()}
|
||||
onSuccess={vi.fn()}
|
||||
initialMode="openrouter"
|
||||
/>
|
||||
);
|
||||
|
||||
const huggingFaceButton = screen.getByText('Hugging Face').closest('button');
|
||||
expect(huggingFaceButton).not.toBeNull();
|
||||
if (!huggingFaceButton) {
|
||||
throw new Error('Hugging Face preset button not found');
|
||||
}
|
||||
|
||||
await userEvent.click(huggingFaceButton);
|
||||
|
||||
expect(screen.getByDisplayValue('hf')).toBeInTheDocument();
|
||||
expect(screen.getByDisplayValue('https://router.huggingface.co/v1')).toBeInTheDocument();
|
||||
expect(screen.getByRole('combobox')).toHaveTextContent('Factory Droid');
|
||||
});
|
||||
});
|
||||
@@ -32,6 +32,13 @@ describe('provider preset metadata', () => {
|
||||
expect(getPresetById('glmt')?.id).toBe('glm');
|
||||
});
|
||||
|
||||
it('maps hf alias to the Hugging Face preset', () => {
|
||||
const preset = getPresetById('hf');
|
||||
expect(preset?.id).toBe('huggingface');
|
||||
expect(preset?.baseUrl).toBe('https://router.huggingface.co/v1');
|
||||
expect(preset?.defaultTarget).toBe('droid');
|
||||
});
|
||||
|
||||
it('uses the llama.cpp provider logo asset for the local llama.cpp preset', () => {
|
||||
expect(getPresetById('llamacpp')?.icon).toBe('/assets/providers/llama-cpp.svg');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user