fix: improve provider and model data accuracy in dashboard
Updated handleGetProviders to include available models and last-used timestamps. Refined Model Pricing table to strictly filter by core providers and actual usage.
This commit is contained in:
BIN
gophergate
BIN
gophergate
Binary file not shown.
@@ -859,6 +859,28 @@ func (s *Server) handleGetProviders(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get last used for this provider
|
||||||
|
var lastUsedTime sql.NullTime
|
||||||
|
_ = s.database.Get(&lastUsedTime, "SELECT MAX(timestamp) FROM llm_requests WHERE provider = ?", id)
|
||||||
|
var lastUsed interface{}
|
||||||
|
if lastUsedTime.Valid && !lastUsedTime.Time.IsZero() {
|
||||||
|
lastUsed = lastUsedTime.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get models for this provider from registry
|
||||||
|
var models []string
|
||||||
|
if s.registry != nil {
|
||||||
|
registryID := id
|
||||||
|
if id == "gemini" { registryID = "google" }
|
||||||
|
if id == "grok" { registryID = "xai" }
|
||||||
|
|
||||||
|
if pInfo, ok := s.registry.Providers[registryID]; ok {
|
||||||
|
for mID := range pInfo.Models {
|
||||||
|
models = append(models, mID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result = append(result, gin.H{
|
result = append(result, gin.H{
|
||||||
"id": id,
|
"id": id,
|
||||||
"name": name,
|
"name": name,
|
||||||
@@ -868,6 +890,8 @@ func (s *Server) handleGetProviders(c *gin.Context) {
|
|||||||
"credit_balance": balance,
|
"credit_balance": balance,
|
||||||
"low_credit_threshold": threshold,
|
"low_credit_threshold": threshold,
|
||||||
"billing_mode": billingMode,
|
"billing_mode": billingMode,
|
||||||
|
"last_used": lastUsed,
|
||||||
|
"models": models,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -329,6 +329,25 @@ body {
|
|||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Badges */
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: baseline;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-success { background-color: rgba(152, 151, 26, 0.15); color: var(--green-light); border: 1px solid var(--green); }
|
||||||
|
.badge-info { background-color: rgba(69, 133, 136, 0.15); color: var(--blue-light); border: 1px solid var(--blue); }
|
||||||
|
.badge-warning { background-color: rgba(215, 153, 33, 0.15); color: var(--yellow-light); border: 1px solid var(--yellow); }
|
||||||
|
.badge-danger { background-color: rgba(204, 36, 29, 0.15); color: var(--red-light); border: 1px solid var(--red); }
|
||||||
|
.badge-client { background-color: var(--bg2); color: var(--fg1); border: 1px solid var(--bg3); padding: 2px 6px; font-size: 0.7rem; text-transform: uppercase; }
|
||||||
|
|
||||||
/* Responsive Login */
|
/* Responsive Login */
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
.login-card {
|
.login-card {
|
||||||
|
|||||||
Reference in New Issue
Block a user