fix: display all quota models, center card content vertically
Some checks failed
Beta Release / beta (push) Has been cancelled

- Handle all quota types in providersQuota, not just TIME_LIMIT
- Extract model name from model field or type field
- Use explicit limit value when available
- Add vertical center alignment to quota card content

💘 Generated with Crush

Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-24 13:15:51 +02:00
parent 24b31b0b47
commit a23c0c5b94
2 changed files with 22 additions and 10 deletions

View File

@@ -496,22 +496,34 @@ func (s *Server) handleProvidersQuota(w http.ResponseWriter, r *http.Request) {
if json.Unmarshal(body, &data) == nil { if json.Unmarshal(body, &data) == nil {
if d, ok := data["data"].(map[string]interface{}); ok { if d, ok := data["data"].(map[string]interface{}); ok {
if limits, ok := d["limits"].([]interface{}); ok { if limits, ok := d["limits"].([]interface{}); ok {
timeLimit := map[string]interface{}{} models := make([]map[string]interface{}, 0)
for _, l := range limits { 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) usage, _ := lm["usage"].(float64)
remaining, _ := lm["remaining"].(float64) remaining, _ := lm["remaining"].(float64)
limitVal, hasLimit := lm["limit"].(float64)
total := usage + remaining total := usage + remaining
timeLimit = map[string]interface{}{ if hasLimit && limitVal > 0 {
"model": "Z.AI", total = limitVal
}
if total > 0 {
models = append(models, map[string]interface{}{
"model": name,
"used": usage, "used": usage,
"total": total, "total": total,
"remaining": remaining, "remaining": remaining,
})
} }
} }
} }
if len(timeLimit) > 0 { if len(models) > 0 {
q.Data = map[string]interface{}{"models": []map[string]interface{}{timeLimit}} q.Data = map[string]interface{}{"models": models}
q.Healthy = true q.Healthy = true
} }
} }

View File

@@ -626,7 +626,7 @@ input::placeholder { color: var(--text-disabled); }
position: relative; position: relative;
background: var(--bg-card); border: 1px solid var(--border); background: var(--bg-card); border: 1px solid var(--border);
border-radius: var(--radius-lg); padding: 14px 16px; 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; overflow: hidden;
} }