diff --git a/webui/src/__tests__/App.test.tsx b/webui/src/__tests__/App.test.tsx index 4062b19..4358321 100644 --- a/webui/src/__tests__/App.test.tsx +++ b/webui/src/__tests__/App.test.tsx @@ -47,8 +47,8 @@ function renderApp() { describe('App Component - Critical Business Logic Only', () => { const mockInstances: Instance[] = [ - { name: 'test-instance-1', status: 'stopped', options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'model1.gguf' } } }, - { name: 'test-instance-2', status: 'running', options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'model2.gguf' } } } + { name: 'test-instance-1', status: 'stopped', options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'model1.gguf' } } }, + { name: 'test-instance-2', status: 'running', options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'model2.gguf' } } } ] beforeEach(() => { @@ -83,7 +83,7 @@ describe('App Component - Critical Business Logic Only', () => { const newInstance: Instance = { name: 'new-test-instance', status: 'stopped', - options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'new-model.gguf' } } + options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'new-model.gguf' } } } vi.mocked(instancesApi.create).mockResolvedValue(newInstance) @@ -106,7 +106,7 @@ describe('App Component - Critical Business Logic Only', () => { await waitFor(() => { expect(instancesApi.create).toHaveBeenCalledWith('new-test-instance', { auto_restart: true, // Default value - backend_type: BackendType.LLAMA_SERVER + backend_type: BackendType.LLAMA_CPP }) }) @@ -121,7 +121,7 @@ describe('App Component - Critical Business Logic Only', () => { const updatedInstance: Instance = { name: 'test-instance-1', status: 'stopped', - options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'updated-model.gguf' } } + options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'updated-model.gguf' } } } vi.mocked(instancesApi.update).mockResolvedValue(updatedInstance) @@ -140,7 +140,7 @@ describe('App Component - Critical Business Logic Only', () => { // Verify correct API call with existing instance data await waitFor(() => { expect(instancesApi.update).toHaveBeenCalledWith('test-instance-1', { - backend_type: BackendType.LLAMA_SERVER, + backend_type: BackendType.LLAMA_CPP, backend_options: { model: "model1.gguf" } // Pre-filled from existing instance }) }) diff --git a/webui/src/components/InstanceDialog.tsx b/webui/src/components/InstanceDialog.tsx index 1c873a8..dc46e31 100644 --- a/webui/src/components/InstanceDialog.tsx +++ b/webui/src/components/InstanceDialog.tsx @@ -10,8 +10,7 @@ import { DialogHeader, DialogTitle, } from "@/components/ui/dialog"; -import type { CreateInstanceOptions, Instance } from "@/types/instance"; -import { BackendType } from "@/types/instance"; +import { BackendType, type CreateInstanceOptions, type Instance } from "@/types/instance"; import { getBasicFields, getAdvancedFields, getBasicBackendFields, getAdvancedBackendFields } from "@/lib/zodFormUtils"; import { ChevronDown, ChevronRight } from "lucide-react"; import ZodFormField from "@/components/ZodFormField"; @@ -55,7 +54,7 @@ const InstanceDialog: React.FC = ({ setInstanceName(""); setFormData({ auto_restart: true, // Default value - backend_type: BackendType.LLAMA_SERVER, // Default backend type + backend_type: BackendType.LLAMA_CPP, // Default backend type backend_options: {}, }); } diff --git a/webui/src/components/ZodFormField.tsx b/webui/src/components/ZodFormField.tsx index 90720c9..f1ab226 100644 --- a/webui/src/components/ZodFormField.tsx +++ b/webui/src/components/ZodFormField.tsx @@ -34,11 +34,11 @@ const ZodFormField: React.FC = ({ fieldKey, value, onChange } {config.description && ( diff --git a/webui/src/components/__tests__/InstanceCard.test.tsx b/webui/src/components/__tests__/InstanceCard.test.tsx index 40fc446..e0c788a 100644 --- a/webui/src/components/__tests__/InstanceCard.test.tsx +++ b/webui/src/components/__tests__/InstanceCard.test.tsx @@ -19,13 +19,13 @@ describe('InstanceCard - Instance Actions and State', () => { const stoppedInstance: Instance = { name: 'test-instance', status: 'stopped', - options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'test-model.gguf' } } + options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'test-model.gguf' } } } const runningInstance: Instance = { name: 'running-instance', status: 'running', - options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'running-model.gguf' } } + options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'running-model.gguf' } } } beforeEach(() => { diff --git a/webui/src/components/__tests__/InstanceList.test.tsx b/webui/src/components/__tests__/InstanceList.test.tsx index 2aa6cc0..cbd9e3f 100644 --- a/webui/src/components/__tests__/InstanceList.test.tsx +++ b/webui/src/components/__tests__/InstanceList.test.tsx @@ -45,9 +45,9 @@ describe('InstanceList - State Management and UI Logic', () => { const mockEditInstance = vi.fn() const mockInstances: Instance[] = [ - { name: 'instance-1', status: 'stopped', options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'model1.gguf' } } }, - { name: 'instance-2', status: 'running', options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'model2.gguf' } } }, - { name: 'instance-3', status: 'stopped', options: { backend_type: BackendType.LLAMA_SERVER, backend_options: { model: 'model3.gguf' } } } + { name: 'instance-1', status: 'stopped', options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'model1.gguf' } } }, + { name: 'instance-2', status: 'running', options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'model2.gguf' } } }, + { name: 'instance-3', status: 'stopped', options: { backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'model3.gguf' } } } ] const DUMMY_API_KEY = 'test-api-key-123' diff --git a/webui/src/components/__tests__/InstanceModal.test.tsx b/webui/src/components/__tests__/InstanceModal.test.tsx index dea389b..0644c3c 100644 --- a/webui/src/components/__tests__/InstanceModal.test.tsx +++ b/webui/src/components/__tests__/InstanceModal.test.tsx @@ -92,7 +92,7 @@ afterEach(() => { expect(mockOnSave).toHaveBeenCalledWith('my-instance', { auto_restart: true, // Default value - backend_type: BackendType.LLAMA_SERVER + backend_type: BackendType.LLAMA_CPP }) }) @@ -138,7 +138,7 @@ afterEach(() => { name: 'existing-instance', status: 'stopped', options: { - backend_type: BackendType.LLAMA_SERVER, + backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'test-model.gguf', gpu_layers: 10 }, auto_restart: false } @@ -179,7 +179,7 @@ afterEach(() => { await user.click(screen.getByTestId('dialog-save-button')) expect(mockOnSave).toHaveBeenCalledWith('existing-instance', { - backend_type: BackendType.LLAMA_SERVER, + backend_type: BackendType.LLAMA_CPP, backend_options: { model: 'test-model.gguf', gpu_layers: 10 }, auto_restart: false }) @@ -273,7 +273,7 @@ afterEach(() => { expect(mockOnSave).toHaveBeenCalledWith('test-instance', { auto_restart: true, - backend_type: BackendType.LLAMA_SERVER, + backend_type: BackendType.LLAMA_CPP, max_restarts: 5, restart_delay: 10 }) @@ -324,7 +324,7 @@ afterEach(() => { // Should only include non-empty values expect(mockOnSave).toHaveBeenCalledWith('clean-instance', { auto_restart: true, // Only this default value should be included - backend_type: BackendType.LLAMA_SERVER + backend_type: BackendType.LLAMA_CPP }) }) @@ -349,7 +349,7 @@ afterEach(() => { expect(mockOnSave).toHaveBeenCalledWith('numeric-test', { auto_restart: true, - backend_type: BackendType.LLAMA_SERVER, + backend_type: BackendType.LLAMA_CPP, backend_options: { gpu_layers: 15 }, // Should be number, not string }) }) diff --git a/webui/src/contexts/__tests__/InstancesContext.test.tsx b/webui/src/contexts/__tests__/InstancesContext.test.tsx index 3ff9d34..c60455f 100644 --- a/webui/src/contexts/__tests__/InstancesContext.test.tsx +++ b/webui/src/contexts/__tests__/InstancesContext.test.tsx @@ -48,13 +48,13 @@ function TestComponent() { {/* Action buttons for testing with specific instances */}