Documentation
¶
Index ¶
- func CreateBackup(src string, backupDst string) error
- func DownloadRelease(url string, destPath string, progressChan chan float64) error
- func ExtractArchive(archivePath string, destDir string) error
- func GetMemoryUsage(pid int) (float64, error)
- func MatchAsset(release *GithubRelease, specs *hardware.HardwareSpecs) (mainAsset *ReleaseAsset, cudartAsset *ReleaseAsset, err error)
- func QueryLocalVersion(llamaCppDir string) (version string, commit string, buildInfo string, err error)
- func QueryServerRequests(port int) (int, error)
- func RollbackBackup(backupSrc string, dst string) error
- type GithubRelease
- type InstanceInfo
- type ReleaseAsset
- type ServerInstance
- type ServerRunner
- func (sr *ServerRunner) GetAllInstances() []InstanceInfo
- func (sr *ServerRunner) GetStatus() (ServerStatus, string, int)
- func (sr *ServerRunner) Start(llamaCppDir string, modelPath string, ctxSize uint32, threads int, ...) error
- func (sr *ServerRunner) Stop() error
- func (sr *ServerRunner) StopInstance(port int) error
- type ServerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBackup ¶
CreateBackup backs up the src folder to backupDst atomically.
func DownloadRelease ¶
DownloadRelease downloads an asset URL and writes progress fraction (0.0 to 1.0) to progressChan.
func ExtractArchive ¶
ExtractArchive extracts zip/tar.gz into destDir and flattens single directories.
func GetMemoryUsage ¶
GetMemoryUsage queries physical memory usage (RSS) of a process in MB.
func MatchAsset ¶
func MatchAsset(release *GithubRelease, specs *hardware.HardwareSpecs) (mainAsset *ReleaseAsset, cudartAsset *ReleaseAsset, err error)
MatchAsset finds the most suitable assets (main binaries and optional cudart DLLs) for the user's OS, CPU/GPU architecture.
func QueryLocalVersion ¶
func QueryLocalVersion(llamaCppDir string) (version string, commit string, buildInfo string, err error)
QueryLocalVersion runs llama-server (or llama-cli) --version and parses output.
func QueryServerRequests ¶
QueryServerRequests queries total completion requests processed via the /metrics endpoint.
func RollbackBackup ¶
RollbackBackup restores the backup directory.
Types ¶
type GithubRelease ¶
type GithubRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
Assets []ReleaseAsset `json:"assets"`
}
func CheckAppRelease ¶ added in v0.2.0
func CheckAppRelease() (*GithubRelease, error)
CheckAppRelease queries GitHub API for the latest llama-manager release.
func CheckLatestRelease ¶
func CheckLatestRelease() (*GithubRelease, error)
CheckLatestRelease queries GitHub API for the latest llama.cpp release.
type InstanceInfo ¶
type ReleaseAsset ¶
type ServerInstance ¶
type ServerRunner ¶
type ServerRunner struct {
// contains filtered or unexported fields
}
func NewServerRunner ¶
func NewServerRunner(logDir string) *ServerRunner
func (*ServerRunner) GetAllInstances ¶
func (sr *ServerRunner) GetAllInstances() []InstanceInfo
GetAllInstances returns status information for all active servers.
func (*ServerRunner) GetStatus ¶
func (sr *ServerRunner) GetStatus() (ServerStatus, string, int)
GetStatus returns the status, running model path, and port of the primary running server (50505 or first found).
func (*ServerRunner) Start ¶
func (sr *ServerRunner) Start(llamaCppDir string, modelPath string, ctxSize uint32, threads int, gpuLayers int, batchSize int, host string, port int) error
Start launches the llama-server on the specified port.
func (*ServerRunner) Stop ¶
func (sr *ServerRunner) Stop() error
Stop terminates ALL running servers.
func (*ServerRunner) StopInstance ¶
func (sr *ServerRunner) StopInstance(port int) error
StopInstance terminates the server running on the specified port.
type ServerStatus ¶
type ServerStatus int
const ( StatusStopped ServerStatus = iota StatusRunning StatusFailed )