diff --git a/internal/api/handlers_info.go b/internal/api/handlers_info.go index 46cf8e3..e6ced66 100644 --- a/internal/api/handlers_info.go +++ b/internal/api/handlers_info.go @@ -496,22 +496,34 @@ func (s *Server) handleProvidersQuota(w http.ResponseWriter, r *http.Request) { if json.Unmarshal(body, &data) == nil { if d, ok := data["data"].(map[string]interface{}); ok { if limits, ok := d["limits"].([]interface{}); ok { - timeLimit := map[string]interface{}{} + models := make([]map[string]interface{}, 0) for _, l := range limits { - if lm, ok := l.(map[string]interface{}); ok && lm["type"] == "TIME_LIMIT" { + if lm, ok := l.(map[string]interface{}); ok { + name := "Z.AI" + if model, ok := lm["model"].(string); ok && model != "" { + name = model + } else if t, ok := lm["type"].(string); ok && t != "TIME_LIMIT" { + name = t + } usage, _ := lm["usage"].(float64) remaining, _ := lm["remaining"].(float64) + limitVal, hasLimit := lm["limit"].(float64) total := usage + remaining - timeLimit = map[string]interface{}{ - "model": "Z.AI", - "used": usage, - "total": total, - "remaining": remaining, + if hasLimit && limitVal > 0 { + total = limitVal + } + if total > 0 { + models = append(models, map[string]interface{}{ + "model": name, + "used": usage, + "total": total, + "remaining": remaining, + }) } } } - if len(timeLimit) > 0 { - q.Data = map[string]interface{}{"models": []map[string]interface{}{timeLimit}} + if len(models) > 0 { + q.Data = map[string]interface{}{"models": models} q.Healthy = true } } diff --git a/web/src/styles/global.css b/web/src/styles/global.css index aee1922..a9eb05f 100644 --- a/web/src/styles/global.css +++ b/web/src/styles/global.css @@ -626,7 +626,7 @@ input::placeholder { color: var(--text-disabled); } position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; - display: flex; flex-direction: column; gap: 8px; + display: flex; flex-direction: column; justify-content: center; gap: 8px; overflow: hidden; }