Learn per-model context from /props?model=; only status "loaded" is loaded
Implemented-By: OpenCode session (model recorded in docs/implementer-log.md)
This commit is contained in:
+16
-10
@@ -30,16 +30,17 @@ type Drainer interface {
|
||||
|
||||
// HostView is one host's row in the hosts view.
|
||||
type HostView struct {
|
||||
Healthy bool `json:"healthy"`
|
||||
Loaded []string `json:"loaded"` // never null
|
||||
LastOK string `json:"last_ok"` // RFC 3339 UTC or ""
|
||||
LastErr string `json:"last_err"`
|
||||
FreeSlots int `json:"free_slots"` // lim.FreeSlots(host)
|
||||
InFlight int `json:"in_flight"` // sum over the host's configured models
|
||||
Queued int `json:"queued"` // same
|
||||
Draining bool `json:"draining"`
|
||||
NCtx int `json:"n_ctx"` // from /props; 0 = unknown
|
||||
Slots int `json:"slots"` // from /props; 0 = unknown
|
||||
Healthy bool `json:"healthy"`
|
||||
Loaded []string `json:"loaded"` // never null
|
||||
LastOK string `json:"last_ok"` // RFC 3339 UTC or ""
|
||||
LastErr string `json:"last_err"`
|
||||
FreeSlots int `json:"free_slots"` // lim.FreeSlots(host)
|
||||
InFlight int `json:"in_flight"` // sum over the host's configured models
|
||||
Queued int `json:"queued"` // same
|
||||
Draining bool `json:"draining"`
|
||||
NCtx int `json:"n_ctx"` // from /props; 0 = unknown
|
||||
Slots int `json:"slots"` // from /props; 0 = unknown
|
||||
Models map[string]health.ModelCtx `json:"models"` // per loaded model; empty object, never null
|
||||
}
|
||||
|
||||
// LeaseView is one lease's row in a route's leases.
|
||||
@@ -114,6 +115,10 @@ func (hx *handler) hostView(name string, s health.Status) HostView {
|
||||
if loaded == nil {
|
||||
loaded = []string{}
|
||||
}
|
||||
models := s.Models
|
||||
if models == nil {
|
||||
models = map[string]health.ModelCtx{}
|
||||
}
|
||||
lastOK := ""
|
||||
if !s.LastOK.IsZero() {
|
||||
lastOK = s.LastOK.UTC().Format(time.RFC3339)
|
||||
@@ -129,6 +134,7 @@ func (hx *handler) hostView(name string, s health.Status) HostView {
|
||||
Draining: hx.d.Draining(name),
|
||||
NCtx: s.NCtx,
|
||||
Slots: s.Slots,
|
||||
Models: models,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user