Refactor instance status management: replace Running boolean with InstanceStatus enum and update related methods

This commit is contained in:
2025-08-27 19:44:38 +02:00
parent 615c2ac54e
commit 1443746add
10 changed files with 111 additions and 45 deletions

View File

@@ -451,7 +451,7 @@ func (h *Handler) ProxyToInstance() http.HandlerFunc {
return
}
if !inst.Running {
if !inst.IsRunning() {
http.Error(w, "Instance is not running", http.StatusServiceUnavailable)
return
}
@@ -574,7 +574,7 @@ func (h *Handler) OpenAIProxy() http.HandlerFunc {
return
}
if !inst.Running {
if !inst.IsRunning() {
if inst.GetOptions().OnDemandStart != nil && *inst.GetOptions().OnDemandStart {
// If on-demand start is enabled, start the instance
if _, err := h.InstanceManager.StartInstance(modelName); err != nil {