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

+20 -3
View File
@@ -49,10 +49,17 @@ func PreferredPoolChannel(c *gin.Context, modelName string) (*model.Channel, str
// Snapshot the routing policy before selection. An older in-flight request
// may finish after a manual switch, but its binding must not override the
// new policy on the next request.
policy := RequestRoutingPolicy(c)
var fingerprintPool []model.TokenGroupEntry
if policy.Mode != "smart" {
fingerprintPool = ResolveRequestPool(c, modelName)
}
// Automatic rankings change with live metrics and availability. They must
// not invalidate a healthy session binding; explicit policy edits still do.
policyJSON, err := common.Marshal(struct {
Policy *model.TokenRoutingPolicy
Pool []model.TokenGroupEntry
}{RequestRoutingPolicy(c), ResolveRequestPool(c, modelName)})
}{policy, fingerprintPool})
if err != nil {
return nil, ""
}
@@ -111,7 +118,7 @@ func PreferredPoolChannel(c *gin.Context, modelName string) (*model.Channel, str
recordDirectSelection(c, nil, binding.Channel, entry.Group, modelName, "pool_group_degraded")
return nil, ""
}
if poolGroupSkipped(c, modelName, entry.Group) || poolHigherPriorityRecovered(c, modelName, entry.Group) {
if poolGroupSkipped(c, modelName, entry.Group) || (policy.Mode != "smart" && poolHigherPriorityRecovered(c, modelName, entry.Group)) {
ClearPoolAffinity(c)
return nil, ""
}
@@ -174,7 +181,17 @@ func ResolveRequestPool(c *gin.Context, modelName string) []model.TokenGroupEntr
}
userGroup := common.GetContextKeyString(c, constant.ContextKeyUserGroup)
if policy.Mode == "smart" {
return WithImageGenerationGroup(c, modelName, resolveAutomaticPool(c, modelName))
entries := WithImageGenerationGroup(c, modelName, resolveAutomaticPool(c, modelName))
if len(policy.ExcludedGroups) == 0 {
return entries
}
filtered := make([]model.TokenGroupEntry, 0, len(entries))
for _, entry := range entries {
if !policy.ExcludesGroup(entry.Group) {
filtered = append(filtered, entry)
}
}
return filtered
}
inherited := GetUserAutoGroup(userGroup)
if policy.Mode == "user" {