4c9ed3c24b
Complete rewrite from Python/FastAPI to Go/Gin: - Go backend: auth (API keys + bcrypt), llama.cpp subprocess manager, hot-swap multi-model, rate limiting, quota system, webhooks - Vue 3 SPA admin panel (src/) with Tailwind CSS - Deployment: Docker multi-stage, docker-compose, nginx, systemd - GORM/SQLite models: ApiKey, Model, UsageLog, Quota, Webhook - REST API: /api/v1/admin/* (keys, models, chat, usage, health) - Embedded frontend via go:embed (build output at web/dist/) Removed legacy Python artifacts (app/, tests/, pyproject.toml, etc.)
35 lines
861 B
Go
35 lines
861 B
Go
package llama
|
|
|
|
import "time"
|
|
|
|
type Status string
|
|
|
|
const (
|
|
StatusStopped Status = "stopped"
|
|
StatusLoading Status = "loading"
|
|
StatusReady Status = "ready"
|
|
StatusSwapping Status = "swapping"
|
|
StatusFailed Status = "failed"
|
|
)
|
|
|
|
type State struct {
|
|
CurrentModel string `json:"current_model"`
|
|
TargetModel string `json:"target_model,omitempty"`
|
|
Status Status `json:"status"`
|
|
PID int `json:"pid,omitempty"`
|
|
LoadedAt *time.Time `json:"loaded_at,omitempty"`
|
|
LastError string `json:"last_error,omitempty"`
|
|
SwapStartedAt *time.Time `json:"swap_started_at,omitempty"`
|
|
SwapInProgress bool `json:"swap_in_progress"`
|
|
}
|
|
|
|
type ModelInfo struct {
|
|
Name string
|
|
ModelPath string
|
|
Alias string
|
|
CtxSize int
|
|
NGPULayers int
|
|
ExtraArgs map[string]interface{}
|
|
IsDefault bool
|
|
}
|