import React, { useState, useEffect } from 'react' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog' import { RefreshCw, AlertCircle, Loader2, ChevronDown, ChevronRight, Monitor, HelpCircle } from 'lucide-react' import { serverApi } from '@/lib/api' interface SystemInfoModalProps { open: boolean onOpenChange: (open: boolean) => void } interface SystemInfo { version: string devices: string help: string } const SystemInfoModal: React.FC = ({ open, onOpenChange }) => { const [systemInfo, setSystemInfo] = useState(null) const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const [showHelp, setShowHelp] = useState(false) // Fetch system info const fetchSystemInfo = async () => { setLoading(true) setError(null) try { const [version, devices, help] = await Promise.all([ serverApi.getVersion(), serverApi.getDevices(), serverApi.getHelp() ]) setSystemInfo({ version, devices, help }) } catch (err) { setError(err instanceof Error ? err.message : 'Failed to fetch system info') } finally { setLoading(false) } } // Load data when modal opens useEffect(() => { if (open) { fetchSystemInfo() } }, [open]) return (
System Information Llama.cpp server environment and capabilities
{loading && !systemInfo ? (
Loading system information...
) : error ? (
{error}
) : systemInfo ? (
{/* Version Section */}

Version

$ llama-server --version
                    {systemInfo.version}
                  
{/* Devices Section */}

Available Devices

$ llama-server --list-devices
                    {systemInfo.devices}
                  
{/* Help Section */}
{showHelp && (
$ llama-server --help
                      {systemInfo.help}
                    
)}
) : null}
) } export default SystemInfoModal