feat: sync deployed v1.0.0-rc.38-custom.67
This commit is contained in:
1 parent
d09216bbde
commit
8e6ed0317b
154 files changed
+39540
-20509
No files matched your search
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/model"
|
||||
"github.com/QuantumNous/new-api/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@@ -60,6 +61,7 @@ func UpdateStatusPageGroup(c *gin.Context) {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
service.InvalidateGroupQualityCache()
|
||||
c.JSON(http.StatusOK, gin.H{"success": true})
|
||||
}
|
||||
|
||||
@@ -70,12 +72,34 @@ func GetSiteGroupStatus(c *gin.Context) {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
costs, costErr := service.GroupModelCosts(c.Request.Context())
|
||||
if costErr != nil {
|
||||
common.SysError("group model costs: " + costErr.Error())
|
||||
}
|
||||
metadata, err := model.GetGroupMetadata(c.Request.Context())
|
||||
if err != nil {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
recent, err := service.RecentDegradedGroups(c.Request.Context())
|
||||
if err != nil {
|
||||
common.ApiError(c, err)
|
||||
return
|
||||
}
|
||||
for i := range results {
|
||||
monitors := make([]Monitor, 0, len(results[i].Monitors))
|
||||
for _, monitor := range results[i].Monitors {
|
||||
monitor.Tags = metadata[monitor.Group].Tags
|
||||
monitor.RecentDegraded = recent[monitor.Group] && !metadata[monitor.Group].HideRecentDegraded
|
||||
monitor.Name = monitor.Group
|
||||
monitor.Alias = ""
|
||||
monitor.Hidden = false
|
||||
monitor.ModelCosts = map[string]model.GroupModelCost{}
|
||||
for _, name := range monitor.Models {
|
||||
if value, ok := costs[monitor.Group][name]; ok {
|
||||
monitor.ModelCosts[name] = value
|
||||
}
|
||||
}
|
||||
monitors = append(monitors, monitor)
|
||||
}
|
||||
results[i].Monitors = monitors
|
||||
|
||||
Reference in new issue
Block a user