feat: publish sanitized custom.97 source

This commit is contained in:
cneicy committed 2026-10-27 20:43:39 +08:00
1 parent 8e6ed0317b
commit 86c0276156
1022 files changed
+69903 -19207

No files matched your search

+32 -20
View File
@@ -10,9 +10,34 @@ import (
var groupDegradationSnapshot struct {
sync.Mutex
updated time.Time
latest map[string]AstraSamplingHistory
benchmark map[string]DetectionHistory
updated time.Time
latest map[string]AstraSamplingHistory
vision map[string]DetectionHistory
ciallo map[string]DetectionHistory
}
func requestGroupQuality(c *gin.Context) (map[string]AstraSamplingHistory, map[string]DetectionHistory, map[string]DetectionHistory) {
if c.GetBool("pool_degradation_unavailable") {
return nil, nil, nil
}
latest, found := c.Get("pool_group_fingerprints")
vision, _ := c.Get("pool_group_visions")
ciallo, _ := c.Get("pool_group_ciallos")
if !found {
rounds, qualities, ciallos, err := cachedGroupQuality(c.Request.Context())
if err != nil {
c.Set("pool_degradation_unavailable", true)
return nil, nil, nil
}
latest, vision, ciallo = rounds, qualities, ciallos
c.Set("pool_group_fingerprints", latest)
c.Set("pool_group_visions", vision)
c.Set("pool_group_ciallos", ciallo)
}
rounds, _ := latest.(map[string]AstraSamplingHistory)
visions, _ := vision.(map[string]DetectionHistory)
ciallos, _ := ciallo.(map[string]DetectionHistory)
return rounds, visions, ciallos
}
func requestGroupDegraded(c *gin.Context, modelName, group string) bool {
@@ -27,22 +52,9 @@ func requestGroupDegraded(c *gin.Context, modelName, group string) bool {
if !skip {
return false
}
if c.GetBool("pool_degradation_unavailable") {
return true
}
latest, found := c.Get("pool_group_fingerprints")
benchmark, _ := c.Get("pool_group_benchmarks")
if !found {
rounds, qualities, err := cachedGroupQuality(c.Request.Context())
if err != nil {
c.Set("pool_degradation_unavailable", true)
return true
}
latest, benchmark = rounds, qualities
c.Set("pool_group_fingerprints", latest)
c.Set("pool_group_benchmarks", benchmark)
}
rounds, _ := latest.(map[string]AstraSamplingHistory)
rounds, visions, ciallos := requestGroupQuality(c)
h, ok := rounds[group]
return (ok && h.ValidSamples > 0 && h.Closest != "" && h.Closest != fingerprint.Model)
return c.GetBool("pool_degradation_unavailable") ||
(ok && h.ValidSamples > 0 && h.Closest != "" && h.Closest != fingerprint.Model) ||
visions[group].Quality == "degraded" || ciallos[group].Quality == "degraded"
}