From e3bf8ac05adea22bcee1385b384a02f956aff8e0 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Tue, 23 Sep 2025 22:05:31 +0200 Subject: [PATCH] Update SystemInfo dialog --- webui/src/App.tsx | 16 +- webui/src/components/ParseCommandDialog.tsx | 6 +- ...endInfoDialog.tsx => SystemInfoDialog.tsx} | 140 +++++++++--------- .../instance/BackendConfigurationCard.tsx | 6 +- 4 files changed, 84 insertions(+), 84 deletions(-) rename webui/src/components/{BackendInfoDialog.tsx => SystemInfoDialog.tsx} (66%) diff --git a/webui/src/App.tsx b/webui/src/App.tsx index b58e54f..04c8c01 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -3,7 +3,7 @@ import Header from "@/components/Header"; import InstanceList from "@/components/InstanceList"; import InstanceDialog from "@/components/InstanceDialog"; import LoginDialog from "@/components/LoginDialog"; -import BackendInfoDialog from "./components/BackendInfoDialog"; +import SystemInfoDialog from "./components/SystemInfoDialog"; import { type CreateInstanceOptions, type Instance } from "@/types/instance"; import { useInstances } from "@/contexts/InstancesContext"; import { useAuth } from "@/contexts/AuthContext"; @@ -13,7 +13,7 @@ import { Toaster } from "sonner"; function App() { const { isAuthenticated, isLoading: authLoading } = useAuth(); const [isInstanceModalOpen, setIsInstanceModalOpen] = useState(false); - const [isBackendInfoModalOpen, setIsBackendInfoModalOpen] = useState(false); + const [isSystemInfoModalOpen, setIsSystemInfoModalOpen] = useState(false); const [editingInstance, setEditingInstance] = useState( undefined ); @@ -37,8 +37,8 @@ function App() { } }; - const handleShowBackendInfo = () => { - setIsBackendInfoModalOpen(true); + const handleShowSystemInfo = () => { + setIsSystemInfoModalOpen(true); }; // Show loading spinner while checking auth @@ -70,7 +70,7 @@ function App() { return (
-
+
@@ -82,9 +82,9 @@ function App() { instance={editingInstance} /> - diff --git a/webui/src/components/ParseCommandDialog.tsx b/webui/src/components/ParseCommandDialog.tsx index 5043a57..ba5075d 100644 --- a/webui/src/components/ParseCommandDialog.tsx +++ b/webui/src/components/ParseCommandDialog.tsx @@ -105,9 +105,9 @@ const ParseCommandDialog: React.FC = ({
diff --git a/webui/src/components/BackendInfoDialog.tsx b/webui/src/components/SystemInfoDialog.tsx similarity index 66% rename from webui/src/components/BackendInfoDialog.tsx rename to webui/src/components/SystemInfoDialog.tsx index 9ce0881..f39d874 100644 --- a/webui/src/components/BackendInfoDialog.tsx +++ b/webui/src/components/SystemInfoDialog.tsx @@ -20,6 +20,7 @@ import { Info } from 'lucide-react' import { serverApi } from '@/lib/api' +import { BackendType, type BackendTypeValue } from '@/types/instance' // Helper to get version from environment const getAppVersion = (): string => { @@ -30,7 +31,7 @@ const getAppVersion = (): string => { } } -interface BackendInfoDialogProps { +interface SystemInfoDialogProps { open: boolean onOpenChange: (open: boolean) => void } @@ -41,27 +42,25 @@ interface BackendInfo { help: string } -type BackendType = 'llama-cpp' | 'mlx' | 'vllm' - const BACKEND_OPTIONS = [ - { value: 'llama-cpp', label: 'Llama.cpp' }, - { value: 'mlx', label: 'MLX' }, - { value: 'vllm', label: 'vLLM' }, -] as const + { value: BackendType.LLAMA_CPP, label: 'Llama Server' }, + { value: BackendType.MLX_LM, label: 'MLX LM' }, + { value: BackendType.VLLM, label: 'vLLM' }, +] -const BackendInfoDialog: React.FC = ({ +const SystemInfoDialog: React.FC = ({ open, onOpenChange }) => { - const [selectedBackend, setSelectedBackend] = useState('llama-cpp') + const [selectedBackend, setSelectedBackend] = useState(BackendType.LLAMA_CPP) const [backendInfo, setBackendInfo] = useState(null) const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const [showHelp, setShowHelp] = useState(false) // Fetch backend info - const fetchBackendInfo = async (backend: BackendType) => { - if (backend !== 'llama-cpp') { + const fetchBackendInfo = async (backend: BackendTypeValue) => { + if (backend !== BackendType.LLAMA_CPP) { setBackendInfo(null) setError(null) return @@ -88,21 +87,21 @@ const BackendInfoDialog: React.FC = ({ // Load data when dialog opens or backend changes useEffect(() => { if (open) { - fetchBackendInfo(selectedBackend) + void fetchBackendInfo(selectedBackend) } }, [open, selectedBackend]) const handleBackendChange = (value: string) => { - setSelectedBackend(value as BackendType) + setSelectedBackend(value as BackendTypeValue) setShowHelp(false) // Reset help section when switching backends } - const renderBackendContent = () => { - if (selectedBackend !== 'llama-cpp') { + const renderBackendSpecificContent = () => { + if (selectedBackend !== BackendType.LLAMA_CPP) { return ( -
+
- +

Backend Info Not Available

@@ -116,7 +115,7 @@ const BackendInfoDialog: React.FC = ({ if (loading && !backendInfo) { return ( -

+
Loading backend information...
@@ -138,17 +137,6 @@ const BackendInfoDialog: React.FC = ({ return (
- {/* Llamactl Version Section */} -
-

Llamactl Version

- -
-
-              {getAppVersion()}
-            
-
-
- {/* Backend Version Section */}

@@ -216,49 +204,61 @@ const BackendInfoDialog: React.FC = ({ -
-
- - - Backend Information - - - View backend-specific environment and capabilities - -
- -
-
- handleBackendChange(value || 'llama-cpp')} - options={BACKEND_OPTIONS} - className="text-sm" - /> -
- - {selectedBackend === 'llama-cpp' && ( - - )} -
-
+ + + System Information + + + View system and backend-specific environment and capabilities +
- {renderBackendContent()} +
+ {/* Llamactl Version Section - Always shown */} +
+

Llamactl Version

+
+
+                  {getAppVersion()}
+                
+
+
+ + {/* Backend Selection Section */} +
+

Backend Information

+
+
+ handleBackendChange(value || BackendType.LLAMA_CPP)} + options={BACKEND_OPTIONS} + className="text-sm" + /> +
+ {selectedBackend === BackendType.LLAMA_CPP && ( + + )} +
+
+ + {/* Backend-specific content */} + {renderBackendSpecificContent()} +
@@ -271,4 +271,4 @@ const BackendInfoDialog: React.FC = ({ ) } -export default BackendInfoDialog \ No newline at end of file +export default SystemInfoDialog \ No newline at end of file diff --git a/webui/src/components/instance/BackendConfigurationCard.tsx b/webui/src/components/instance/BackendConfigurationCard.tsx index 3e5e43f..5bf7c36 100644 --- a/webui/src/components/instance/BackendConfigurationCard.tsx +++ b/webui/src/components/instance/BackendConfigurationCard.tsx @@ -37,9 +37,9 @@ const BackendConfigurationCard: React.FC = ({ value={formData.backend_type || BackendType.LLAMA_CPP} onChange={(value) => onChange('backend_type', value)} options={[ - { value: BackendType.LLAMA_CPP, label: 'Llama Server (llama_cpp)' }, - { value: BackendType.MLX_LM, label: 'MLX LM (mlx_lm)' }, - { value: BackendType.VLLM, label: 'vLLM (vllm)' } + { value: BackendType.LLAMA_CPP, label: 'Llama Server' }, + { value: BackendType.MLX_LM, label: 'MLX LM' }, + { value: BackendType.VLLM, label: 'vLLM' } ]} description="Select the backend server type" />