mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-12-22 17:14:22 +00:00
Add command override to webui
This commit is contained in:
@@ -106,6 +106,14 @@ const InstanceDialog: React.FC<InstanceDialogProps> = ({
|
|||||||
return;
|
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
|
// Clean up undefined values to avoid sending empty fields
|
||||||
const cleanOptions: CreateInstanceOptions = {} as CreateInstanceOptions;
|
const cleanOptions: CreateInstanceOptions = {} as CreateInstanceOptions;
|
||||||
Object.entries(formData).forEach(([key, value]) => {
|
Object.entries(formData).forEach(([key, value]) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
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 { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
||||||
import { Label } from '@/components/ui/label'
|
import { Label } from '@/components/ui/label'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
@@ -8,6 +8,7 @@ import NumberInput from '@/components/form/NumberInput'
|
|||||||
import CheckboxInput from '@/components/form/CheckboxInput'
|
import CheckboxInput from '@/components/form/CheckboxInput'
|
||||||
import EnvVarsInput from '@/components/form/EnvVarsInput'
|
import EnvVarsInput from '@/components/form/EnvVarsInput'
|
||||||
import SelectInput from '@/components/form/SelectInput'
|
import SelectInput from '@/components/form/SelectInput'
|
||||||
|
import TextInput from '@/components/form/TextInput'
|
||||||
import { nodesApi, type NodesMap } from '@/lib/api'
|
import { nodesApi, type NodesMap } from '@/lib/api'
|
||||||
|
|
||||||
interface InstanceSettingsCardProps {
|
interface InstanceSettingsCardProps {
|
||||||
@@ -105,6 +106,48 @@ const InstanceSettingsCard: React.FC<InstanceSettingsCardProps> = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Execution Context */}
|
||||||
|
<div className="space-y-4">
|
||||||
|
<h3 className="text-lg font-medium">Execution Context</h3>
|
||||||
|
|
||||||
|
{/* Docker Mode Toggle - only for backends that support Docker */}
|
||||||
|
{formData.backend_type !== BackendType.MLX_LM && (
|
||||||
|
<CheckboxInput
|
||||||
|
id="docker_enabled"
|
||||||
|
label="Enable Docker"
|
||||||
|
value={formData.docker_enabled}
|
||||||
|
onChange={(value) => 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) && (
|
||||||
|
<TextInput
|
||||||
|
id="command_override"
|
||||||
|
label="Command Override"
|
||||||
|
value={formData.command_override || ''}
|
||||||
|
onChange={(value) => 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"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<EnvVarsInput
|
||||||
|
id="environment"
|
||||||
|
label="Environment Variables"
|
||||||
|
value={formData.environment}
|
||||||
|
onChange={(value) => onChange('environment', value)}
|
||||||
|
description="Custom environment variables for the instance"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* Auto Restart Configuration */}
|
{/* Auto Restart Configuration */}
|
||||||
<AutoRestartConfiguration
|
<AutoRestartConfiguration
|
||||||
formData={formData}
|
formData={formData}
|
||||||
@@ -131,14 +174,6 @@ const InstanceSettingsCard: React.FC<InstanceSettingsCardProps> = ({
|
|||||||
onChange={(value) => onChange('on_demand_start', value)}
|
onChange={(value) => onChange('on_demand_start', value)}
|
||||||
description="Start instance only when needed"
|
description="Start instance only when needed"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EnvVarsInput
|
|
||||||
id="environment"
|
|
||||||
label="Environment Variables"
|
|
||||||
value={formData.environment}
|
|
||||||
onChange={(value) => onChange('environment', value)}
|
|
||||||
description="Custom environment variables for the instance"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ export const CreateInstanceOptionsSchema = z.object({
|
|||||||
// Environment variables
|
// Environment variables
|
||||||
environment: z.record(z.string(), z.string()).optional(),
|
environment: z.record(z.string(), z.string()).optional(),
|
||||||
|
|
||||||
|
// Execution context overrides
|
||||||
|
docker_enabled: z.boolean().optional(),
|
||||||
|
command_override: z.string().optional(),
|
||||||
|
|
||||||
// Backend configuration
|
// Backend configuration
|
||||||
backend_type: z.enum([BackendType.LLAMA_CPP, BackendType.MLX_LM, BackendType.VLLM]).optional(),
|
backend_type: z.enum([BackendType.LLAMA_CPP, BackendType.MLX_LM, BackendType.VLLM]).optional(),
|
||||||
backend_options: BackendOptionsSchema.optional(),
|
backend_options: BackendOptionsSchema.optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user