diff --git a/webui/src/components/InstanceDialog.tsx b/webui/src/components/InstanceDialog.tsx index 25d48a3..8711218 100644 --- a/webui/src/components/InstanceDialog.tsx +++ b/webui/src/components/InstanceDialog.tsx @@ -106,6 +106,14 @@ const InstanceDialog: React.FC = ({ return; } + // Validate docker_enabled and command_override relationship + if (formData.backend_type !== BackendType.MLX_LM) { + if (formData.docker_enabled === true && formData.command_override) { + setNameError("Command override cannot be set when Docker is enabled"); + return; + } + } + // Clean up undefined values to avoid sending empty fields const cleanOptions: CreateInstanceOptions = {} as CreateInstanceOptions; Object.entries(formData).forEach(([key, value]) => { diff --git a/webui/src/components/instance/InstanceSettingsCard.tsx b/webui/src/components/instance/InstanceSettingsCard.tsx index 7b853cb..d1ba4c0 100644 --- a/webui/src/components/instance/InstanceSettingsCard.tsx +++ b/webui/src/components/instance/InstanceSettingsCard.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react' -import type { CreateInstanceOptions } from '@/types/instance' +import { BackendType, type CreateInstanceOptions } from '@/types/instance' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Label } from '@/components/ui/label' import { Input } from '@/components/ui/input' @@ -8,6 +8,7 @@ import NumberInput from '@/components/form/NumberInput' import CheckboxInput from '@/components/form/CheckboxInput' import EnvVarsInput from '@/components/form/EnvVarsInput' import SelectInput from '@/components/form/SelectInput' +import TextInput from '@/components/form/TextInput' import { nodesApi, type NodesMap } from '@/lib/api' interface InstanceSettingsCardProps { @@ -105,6 +106,48 @@ const InstanceSettingsCard: React.FC = ({ /> )} + {/* Execution Context */} +
+

Execution Context

+ + {/* Docker Mode Toggle - only for backends that support Docker */} + {formData.backend_type !== BackendType.MLX_LM && ( + onChange('docker_enabled', value)} + description="Run backend in Docker container (overrides config default)" + /> + )} + + {/* Command Override - only shown when Docker is disabled or backend is MLX */} + {(formData.backend_type === BackendType.MLX_LM || formData.docker_enabled !== true) && ( + onChange('command_override', value)} + placeholder={ + formData.backend_type === BackendType.LLAMA_CPP + ? "/usr/local/bin/llama-server" + : formData.backend_type === BackendType.VLLM + ? "/usr/local/bin/vllm" + : "/usr/local/bin/mlx_lm.server" + } + description="Custom path to backend executable" + /> + )} + + onChange('environment', value)} + description="Custom environment variables for the instance" + /> +
+ {/* Auto Restart Configuration */} = ({ onChange={(value) => onChange('on_demand_start', value)} description="Start instance only when needed" /> - - onChange('environment', value)} - description="Custom environment variables for the instance" - /> diff --git a/webui/src/schemas/instanceOptions.ts b/webui/src/schemas/instanceOptions.ts index 3cbf523..b7530e1 100644 --- a/webui/src/schemas/instanceOptions.ts +++ b/webui/src/schemas/instanceOptions.ts @@ -36,6 +36,10 @@ export const CreateInstanceOptionsSchema = z.object({ // Environment variables environment: z.record(z.string(), z.string()).optional(), + // Execution context overrides + docker_enabled: z.boolean().optional(), + command_override: z.string().optional(), + // Backend configuration backend_type: z.enum([BackendType.LLAMA_CPP, BackendType.MLX_LM, BackendType.VLLM]).optional(), backend_options: BackendOptionsSchema.optional(),