import { Stack, Group, Text, TextInput, NumberInput, Button, SimpleGrid, ActionIcon, } from '@mantine/core'; import { useState, useEffect } from 'react'; import { Plus, Trash2 } from 'lucide-react'; import { InfoTooltip } from '@/components/InfoTooltip'; import { CheckboxWithTooltip } from '@/components/CheckboxWithTooltip'; import { CommandLineArgumentsModal } from '@/components/screens/Launch/CommandLineArgumentsModal'; import { useLaunchConfig } from '@/hooks/useLaunchConfig'; export const AdvancedTab = () => { const { additionalArguments, preLaunchCommands, noshift, flashattention, noavx2, failsafe, lowvram, quantmatmul, usemmap, debugmode, backend, moecpu, moeexperts, handleAdditionalArgumentsChange, handlePreLaunchCommandsChange, handleNoshiftChange, handleFlashattentionChange, handleNoavx2Change, handleFailsafeChange, handleLowvramChange, handleQuantmatmulChange, handleUsemmapChange, handleDebugmodeChange, handleMoecpuChange, handleMoeexpertsChange, } = useLaunchConfig(); const [commandLineModalOpen, setCommandLineModalOpen] = useState(false); const [backendSupport, setBackendSupport] = useState<{ noavx2: boolean; failsafe: boolean; } | null>(null); const [isLoading, setIsLoading] = useState(true); const handleAddArgument = (newArgument: string) => { const currentArgs = additionalArguments.trim(); const updatedArgs = currentArgs ? `${currentArgs} ${newArgument}` : newArgument; handleAdditionalArgumentsChange(updatedArgs); }; const isGpuBackend = backend === 'cuda' || backend === 'rocm'; useEffect(() => { const detectAccelerationSupport = async () => { const support = await window.electronAPI.kobold.detectAccelerationSupport(); if (support) { setBackendSupport({ noavx2: support.noavx2, failsafe: support.failsafe, }); } else { setBackendSupport({ noavx2: false, failsafe: false }); } setIsLoading(false); }; void detectAccelerationSupport(); }, []); return (
handleNoshiftChange(!checked)} label="Context Shift" tooltip="Use Context Shifting to reduce reprocessing." />
MoE Experts handleMoeexpertsChange(Number(value))} min={-1} max={128} step={1} size="sm" />
MoE CPU Layers handleMoecpuChange(Number(value) || 0)} min={0} max={999} step={1} size="sm" />
Additional Arguments handleAdditionalArgumentsChange(event.currentTarget.value) } />
Pre-Launch Commands {preLaunchCommands.map((command, index) => ( { const newCommands = [...preLaunchCommands]; newCommands[index] = event.currentTarget.value; handlePreLaunchCommandsChange(newCommands); }} style={{ flex: 1 }} /> { const newCommands = preLaunchCommands.filter( (_, i) => i !== index ); handlePreLaunchCommandsChange( newCommands.length === 0 ? [''] : newCommands ); }} > ))}
setCommandLineModalOpen(false)} onAddArgument={handleAddArgument} />
); };