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:
@@ -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{
|
||||
"id": id,
|
||||
"name": name,
|
||||
@@ -868,6 +890,8 @@ func (s *Server) handleGetProviders(c *gin.Context) {
|
||||
"credit_balance": balance,
|
||||
"low_credit_threshold": threshold,
|
||||
"billing_mode": billingMode,
|
||||
"last_used": lastUsed,
|
||||
"models": models,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user