mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 09:04:27 +00:00
Merge pull request #40 from lordmathis/feat/system-info
feat: rework system info dialog
This commit is contained in:
168
apidocs/docs.go
168
apidocs/docs.go
@@ -19,6 +19,62 @@ const docTemplate = `{
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/backends/llama-cpp/devices": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns a list of available devices for the llama server",
|
||||
"tags": [
|
||||
"backends"
|
||||
],
|
||||
"summary": "List available devices for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of devices",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/llama-cpp/help": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the help text for the llama server command",
|
||||
"tags": [
|
||||
"backends"
|
||||
],
|
||||
"summary": "Get help for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Help text",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/llama-cpp/parse-command": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -76,6 +132,34 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/llama-cpp/version": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the version of the llama server command",
|
||||
"tags": [
|
||||
"backends"
|
||||
],
|
||||
"summary": "Get version of llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Version information",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/mlx/parse-command": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -658,90 +742,6 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/server/devices": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns a list of available devices for the llama server",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "List available devices for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of devices",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/server/help": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the help text for the llama server command",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "Get help for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Help text",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/server/version": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the version of the llama server command",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "Get version of llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Version information",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
||||
@@ -12,6 +12,62 @@
|
||||
},
|
||||
"basePath": "/api/v1",
|
||||
"paths": {
|
||||
"/backends/llama-cpp/devices": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns a list of available devices for the llama server",
|
||||
"tags": [
|
||||
"backends"
|
||||
],
|
||||
"summary": "List available devices for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of devices",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/llama-cpp/help": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the help text for the llama server command",
|
||||
"tags": [
|
||||
"backends"
|
||||
],
|
||||
"summary": "Get help for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Help text",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/llama-cpp/parse-command": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -69,6 +125,34 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/llama-cpp/version": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the version of the llama server command",
|
||||
"tags": [
|
||||
"backends"
|
||||
],
|
||||
"summary": "Get version of llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Version information",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/backends/mlx/parse-command": {
|
||||
"post": {
|
||||
"security": [
|
||||
@@ -651,90 +735,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/server/devices": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns a list of available devices for the llama server",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "List available devices for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of devices",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/server/help": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the help text for the llama server command",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "Get help for llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Help text",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/server/version": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the version of the llama server command",
|
||||
"tags": [
|
||||
"server"
|
||||
],
|
||||
"summary": "Get version of llama server",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Version information",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
||||
@@ -88,6 +88,40 @@ info:
|
||||
title: llamactl API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/backends/llama-cpp/devices:
|
||||
get:
|
||||
description: Returns a list of available devices for the llama server
|
||||
responses:
|
||||
"200":
|
||||
description: List of devices
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List available devices for llama server
|
||||
tags:
|
||||
- backends
|
||||
/backends/llama-cpp/help:
|
||||
get:
|
||||
description: Returns the help text for the llama server command
|
||||
responses:
|
||||
"200":
|
||||
description: Help text
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get help for llama server
|
||||
tags:
|
||||
- backends
|
||||
/backends/llama-cpp/parse-command:
|
||||
post:
|
||||
consumes:
|
||||
@@ -124,6 +158,23 @@ paths:
|
||||
summary: Parse llama-server command
|
||||
tags:
|
||||
- backends
|
||||
/backends/llama-cpp/version:
|
||||
get:
|
||||
description: Returns the version of the llama server command
|
||||
responses:
|
||||
"200":
|
||||
description: Version information
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get version of llama server
|
||||
tags:
|
||||
- backends
|
||||
/backends/mlx/parse-command:
|
||||
post:
|
||||
consumes:
|
||||
@@ -494,57 +545,6 @@ paths:
|
||||
summary: Stop a running instance
|
||||
tags:
|
||||
- instances
|
||||
/server/devices:
|
||||
get:
|
||||
description: Returns a list of available devices for the llama server
|
||||
responses:
|
||||
"200":
|
||||
description: List of devices
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: List available devices for llama server
|
||||
tags:
|
||||
- server
|
||||
/server/help:
|
||||
get:
|
||||
description: Returns the help text for the llama server command
|
||||
responses:
|
||||
"200":
|
||||
description: Help text
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get help for llama server
|
||||
tags:
|
||||
- server
|
||||
/server/version:
|
||||
get:
|
||||
description: Returns the version of the llama server command
|
||||
responses:
|
||||
"200":
|
||||
description: Version information
|
||||
schema:
|
||||
type: string
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get version of llama server
|
||||
tags:
|
||||
- server
|
||||
/v1/:
|
||||
post:
|
||||
consumes:
|
||||
|
||||
@@ -51,12 +51,12 @@ func (h *Handler) VersionHandler() http.HandlerFunc {
|
||||
// LlamaServerHelpHandler godoc
|
||||
// @Summary Get help for llama server
|
||||
// @Description Returns the help text for the llama server command
|
||||
// @Tags server
|
||||
// @Tags backends
|
||||
// @Security ApiKeyAuth
|
||||
// @Produces text/plain
|
||||
// @Success 200 {string} string "Help text"
|
||||
// @Failure 500 {string} string "Internal Server Error"
|
||||
// @Router /server/help [get]
|
||||
// @Router /backends/llama-cpp/help [get]
|
||||
func (h *Handler) LlamaServerHelpHandler() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
helpCmd := exec.Command("llama-server", "--help")
|
||||
@@ -73,12 +73,12 @@ func (h *Handler) LlamaServerHelpHandler() http.HandlerFunc {
|
||||
// LlamaServerVersionHandler godoc
|
||||
// @Summary Get version of llama server
|
||||
// @Description Returns the version of the llama server command
|
||||
// @Tags server
|
||||
// @Tags backends
|
||||
// @Security ApiKeyAuth
|
||||
// @Produces text/plain
|
||||
// @Success 200 {string} string "Version information"
|
||||
// @Failure 500 {string} string "Internal Server Error"
|
||||
// @Router /server/version [get]
|
||||
// @Router /backends/llama-cpp/version [get]
|
||||
func (h *Handler) LlamaServerVersionHandler() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
versionCmd := exec.Command("llama-server", "--version")
|
||||
@@ -95,12 +95,12 @@ func (h *Handler) LlamaServerVersionHandler() http.HandlerFunc {
|
||||
// LlamaServerListDevicesHandler godoc
|
||||
// @Summary List available devices for llama server
|
||||
// @Description Returns a list of available devices for the llama server
|
||||
// @Tags server
|
||||
// @Tags backends
|
||||
// @Security ApiKeyAuth
|
||||
// @Produces text/plain
|
||||
// @Success 200 {string} string "List of devices"
|
||||
// @Failure 500 {string} string "Internal Server Error"
|
||||
// @Router /server/devices [get]
|
||||
// @Router /backends/llama-cpp/devices [get]
|
||||
func (h *Handler) LlamaServerListDevicesHandler() http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
listCmd := exec.Command("llama-server", "--list-devices")
|
||||
|
||||
@@ -44,15 +44,12 @@ func SetupRouter(handler *Handler) *chi.Mux {
|
||||
|
||||
r.Get("/version", handler.VersionHandler()) // Get server version
|
||||
|
||||
r.Route("/server", func(r chi.Router) {
|
||||
r.Get("/help", handler.LlamaServerHelpHandler())
|
||||
r.Get("/version", handler.LlamaServerVersionHandler())
|
||||
r.Get("/devices", handler.LlamaServerListDevicesHandler())
|
||||
})
|
||||
|
||||
// Backend-specific endpoints
|
||||
r.Route("/backends", func(r chi.Router) {
|
||||
r.Route("/llama-cpp", func(r chi.Router) {
|
||||
r.Get("/help", handler.LlamaServerHelpHandler())
|
||||
r.Get("/version", handler.LlamaServerVersionHandler())
|
||||
r.Get("/devices", handler.LlamaServerListDevicesHandler())
|
||||
r.Post("/parse-command", handler.ParseLlamaCommand())
|
||||
})
|
||||
r.Route("/mlx", func(r chi.Router) {
|
||||
|
||||
@@ -105,9 +105,9 @@ const ParseCommandDialog: React.FC<ParseCommandDialogProps> = ({
|
||||
<div>
|
||||
<Label className="text-sm font-medium">Backend Type:
|
||||
<span className="font-normal text-muted-foreground">
|
||||
{backendType === BackendType.LLAMA_CPP && 'Llama Server (llama_cpp)'}
|
||||
{backendType === BackendType.MLX_LM && 'MLX LM (mlx_lm)'}
|
||||
{backendType === BackendType.VLLM && 'vLLM (vllm)'}
|
||||
{backendType === BackendType.LLAMA_CPP && 'Llama Server'}
|
||||
{backendType === BackendType.MLX_LM && 'MLX LM'}
|
||||
{backendType === BackendType.VLLM && 'vLLM'}
|
||||
</span>
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog'
|
||||
import SelectInput from '@/components/form/SelectInput'
|
||||
import {
|
||||
RefreshCw,
|
||||
AlertCircle,
|
||||
@@ -15,9 +16,11 @@ import {
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
Monitor,
|
||||
HelpCircle
|
||||
HelpCircle,
|
||||
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 => {
|
||||
@@ -28,28 +31,41 @@ const getAppVersion = (): string => {
|
||||
}
|
||||
}
|
||||
|
||||
interface SystemInfoModalProps {
|
||||
interface SystemInfoDialogProps {
|
||||
open: boolean
|
||||
onOpenChange: (open: boolean) => void
|
||||
}
|
||||
|
||||
interface SystemInfo {
|
||||
interface BackendInfo {
|
||||
version: string
|
||||
devices: string
|
||||
help: string
|
||||
}
|
||||
|
||||
const SystemInfoDialog: React.FC<SystemInfoModalProps> = ({
|
||||
const BACKEND_OPTIONS = [
|
||||
{ value: BackendType.LLAMA_CPP, label: 'Llama Server' },
|
||||
{ value: BackendType.MLX_LM, label: 'MLX LM' },
|
||||
{ value: BackendType.VLLM, label: 'vLLM' },
|
||||
]
|
||||
|
||||
const SystemInfoDialog: React.FC<SystemInfoDialogProps> = ({
|
||||
open,
|
||||
onOpenChange
|
||||
}) => {
|
||||
const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null)
|
||||
const [selectedBackend, setSelectedBackend] = useState<BackendTypeValue>(BackendType.LLAMA_CPP)
|
||||
const [backendInfo, setBackendInfo] = useState<BackendInfo | null>(null)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [showHelp, setShowHelp] = useState(false)
|
||||
|
||||
// Fetch system info
|
||||
const fetchSystemInfo = async () => {
|
||||
// Fetch backend info
|
||||
const fetchBackendInfo = async (backend: BackendTypeValue) => {
|
||||
if (backend !== BackendType.LLAMA_CPP) {
|
||||
setBackendInfo(null)
|
||||
setError(null)
|
||||
return
|
||||
}
|
||||
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
|
||||
@@ -60,85 +76,79 @@ const SystemInfoDialog: React.FC<SystemInfoModalProps> = ({
|
||||
serverApi.getHelp()
|
||||
])
|
||||
|
||||
setSystemInfo({ version, devices, help })
|
||||
setBackendInfo({ version, devices, help })
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to fetch system info')
|
||||
setError(err instanceof Error ? err.message : 'Failed to fetch backend info')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
// Load data when dialog opens
|
||||
// Load data when dialog opens or backend changes
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
fetchSystemInfo()
|
||||
void fetchBackendInfo(selectedBackend)
|
||||
}
|
||||
}, [open])
|
||||
}, [open, selectedBackend])
|
||||
|
||||
const handleBackendChange = (value: string) => {
|
||||
setSelectedBackend(value as BackendTypeValue)
|
||||
setShowHelp(false) // Reset help section when switching backends
|
||||
}
|
||||
|
||||
const renderBackendSpecificContent = () => {
|
||||
if (selectedBackend !== BackendType.LLAMA_CPP) {
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange} >
|
||||
<DialogContent className="sm:max-w-4xl max-w-[calc(100%-2rem)] max-h-[80vh] flex flex-col">
|
||||
<DialogHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center justify-center py-8">
|
||||
<div className="text-center space-y-3">
|
||||
<Info className="h-8 w-8 text-gray-400 mx-auto" />
|
||||
<div>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Monitor className="h-5 w-5" />
|
||||
System Information
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
Llama.cpp server environment and capabilities
|
||||
</DialogDescription>
|
||||
<h3 className="font-semibold text-gray-700">Backend Info Not Available</h3>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
Information for {BACKEND_OPTIONS.find(b => b.value === selectedBackend)?.label} backend is not yet implemented.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={fetchSystemInfo}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<RefreshCw className="h-4 w-4" />
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</DialogHeader>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
{loading && !systemInfo ? (
|
||||
<div className="flex items-center justify-center py-12">
|
||||
if (loading && !backendInfo) {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-8">
|
||||
<Loader2 className="h-6 w-6 animate-spin text-gray-400" />
|
||||
<span className="ml-2 text-gray-400">Loading system information...</span>
|
||||
<span className="ml-2 text-gray-400">Loading backend information...</span>
|
||||
</div>
|
||||
) : error ? (
|
||||
)
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="flex items-center gap-2 p-4 bg-destructive/10 border border-destructive/20 rounded-lg">
|
||||
<AlertCircle className="h-4 w-4 text-destructive" />
|
||||
<span className="text-sm text-destructive">{error}</span>
|
||||
</div>
|
||||
) : systemInfo ? (
|
||||
)
|
||||
}
|
||||
|
||||
if (!backendInfo) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Llamactl Version Section */}
|
||||
{/* Backend Version Section */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="font-semibold">Llamactl Version</h3>
|
||||
|
||||
<div className="bg-gray-900 rounded-lg p-4">
|
||||
<pre className="text-sm text-gray-300 whitespace-pre-wrap font-mono">
|
||||
{getAppVersion()}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Llama Server Version Section */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="font-semibold">Llama Server Version</h3>
|
||||
<h3 className="font-semibold">
|
||||
{BACKEND_OPTIONS.find(b => b.value === selectedBackend)?.label} Version
|
||||
</h3>
|
||||
|
||||
<div className="bg-gray-900 rounded-lg p-4">
|
||||
<div className="mb-2">
|
||||
<span className="text-sm text-gray-400">$ llama-server --version</span>
|
||||
</div>
|
||||
<pre className="text-sm text-gray-300 whitespace-pre-wrap font-mono">
|
||||
{systemInfo.version}
|
||||
{backendInfo.version}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,7 +164,7 @@ const SystemInfoDialog: React.FC<SystemInfoModalProps> = ({
|
||||
<span className="text-sm text-gray-400">$ llama-server --list-devices</span>
|
||||
</div>
|
||||
<pre className="text-sm text-gray-300 whitespace-pre-wrap font-mono">
|
||||
{systemInfo.devices}
|
||||
{backendInfo.devices}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -181,13 +191,74 @@ const SystemInfoDialog: React.FC<SystemInfoModalProps> = ({
|
||||
<span className="text-sm text-gray-400">$ llama-server --help</span>
|
||||
</div>
|
||||
<pre className="text-sm text-gray-300 whitespace-pre-wrap font-mono max-h-64 overflow-y-auto">
|
||||
{systemInfo.help}
|
||||
{backendInfo.help}
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="sm:max-w-4xl max-w-[calc(100%-2rem)] max-h-[80vh] flex flex-col">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<Monitor className="h-5 w-5" />
|
||||
System Information
|
||||
</DialogTitle>
|
||||
<DialogDescription>
|
||||
View system and backend-specific environment and capabilities
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<div className="space-y-6">
|
||||
{/* Llamactl Version Section - Always shown */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="font-semibold">Llamactl Version</h3>
|
||||
<div className="bg-gray-900 rounded-lg p-4">
|
||||
<pre className="text-sm text-gray-300 whitespace-pre-wrap font-mono">
|
||||
{getAppVersion()}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Backend Selection Section */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="font-semibold">Backend Information</h3>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="flex-1">
|
||||
<SelectInput
|
||||
id="backend-select"
|
||||
label=""
|
||||
value={selectedBackend}
|
||||
onChange={(value) => handleBackendChange(value || BackendType.LLAMA_CPP)}
|
||||
options={BACKEND_OPTIONS}
|
||||
className="text-sm"
|
||||
/>
|
||||
</div>
|
||||
{selectedBackend === BackendType.LLAMA_CPP && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => void fetchBackendInfo(selectedBackend)}
|
||||
disabled={loading}
|
||||
>
|
||||
{loading ? (
|
||||
<Loader2 className="h-4 w-4 animate-spin" />
|
||||
) : (
|
||||
<RefreshCw className="h-4 w-4" />
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Backend-specific content */}
|
||||
{renderBackendSpecificContent()}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
|
||||
@@ -37,9 +37,9 @@ const BackendConfigurationCard: React.FC<BackendConfigurationCardProps> = ({
|
||||
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"
|
||||
/>
|
||||
|
||||
@@ -63,16 +63,16 @@ async function apiCall<T>(
|
||||
}
|
||||
}
|
||||
|
||||
// Server API functions
|
||||
// Server API functions (moved to llama-cpp backend)
|
||||
export const serverApi = {
|
||||
// GET /server/help
|
||||
getHelp: () => apiCall<string>("/server/help", {}, "text"),
|
||||
// GET /backends/llama-cpp/help
|
||||
getHelp: () => apiCall<string>("/backends/llama-cpp/help", {}, "text"),
|
||||
|
||||
// GET /server/version
|
||||
getVersion: () => apiCall<string>("/server/version", {}, "text"),
|
||||
// GET /backends/llama-cpp/version
|
||||
getVersion: () => apiCall<string>("/backends/llama-cpp/version", {}, "text"),
|
||||
|
||||
// GET /server/devices
|
||||
getDevices: () => apiCall<string>("/server/devices", {}, "text"),
|
||||
// GET /backends/llama-cpp/devices
|
||||
getDevices: () => apiCall<string>("/backends/llama-cpp/devices", {}, "text"),
|
||||
};
|
||||
|
||||
// Backend API functions
|
||||
@@ -156,5 +156,5 @@ export const instancesApi = {
|
||||
},
|
||||
|
||||
// GET /instances/{name}/proxy/health
|
||||
getHealth: (name: string) => apiCall<any>(`/instances/${name}/proxy/health`),
|
||||
getHealth: (name: string) => apiCall<Record<string, unknown>>(`/instances/${name}/proxy/health`),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user