feat: sync deployed v1.0.0-rc.38-custom.42

Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
cneicy committed 2026-09-26 04:49:11 +08:00
1 parent aa6c3f50f4
commit ceddfd3d6b
828 files changed
+122253 -13702

No files matched your search

+18 -1
View File
@@ -550,6 +550,7 @@ func ApplyChannelAffinityOverrideTemplate(c *gin.Context, paramOverride map[stri
func GetPreferredChannelByAffinity(c *gin.Context, modelName string, usingGroup string) (int, bool) {
setting := operation_setting.GetChannelAffinitySetting()
state := RequestPolicy(c)
if setting == nil || !setting.Enabled {
return 0, false
}
@@ -594,11 +595,13 @@ func GetPreferredChannelByAffinity(c *gin.Context, modelName string, usingGroup
}
cacheKeySuffix := buildChannelAffinityCacheKeySuffix(rule, modelName, usingGroup, affinityValue)
cacheKeyFull := channelAffinityCacheNamespace + ":" + cacheKeySuffix
state.SessionMode, state.SessionModeSource = EffectiveSessionMode(setting, rule)
state.RuleName = rule.Name
setChannelAffinityContext(c, channelAffinityMeta{
CacheKey: cacheKeyFull,
TTLSeconds: ttlSeconds,
RuleName: rule.Name,
SkipRetry: rule.SkipRetryOnFailure,
SkipRetry: state.SessionMode == "strict",
ParamTemplate: cloneStringAnyMap(rule.ParamOverrideTemplate),
KeySourceType: strings.TrimSpace(usedSource.Type),
KeySourceKey: strings.TrimSpace(usedSource.Key),
@@ -610,6 +613,10 @@ func GetPreferredChannelByAffinity(c *gin.Context, modelName string, usingGroup
RequestPath: path,
})
state.AddEvent(PolicyEvent{Decision: PolicyDecision{Action: "match", Reason: "session_rule_matched", Source: "session_rule"}})
if state.SessionMode == "off" {
return 0, false
}
cache := getChannelAffinityCache()
channelID, found, err := cache.Get(cacheKeySuffix)
if err != nil {
@@ -719,6 +726,13 @@ func AppendChannelAffinityAdminInfo(c *gin.Context, other *model.LogOther) {
if !ok || anyInfo == nil {
return
}
// The hint can be the whole session value for short keys; logs keep only
// the fingerprint.
if info, ok := anyInfo.(map[string]any); ok {
sanitized := cloneStringAnyMap(info)
delete(sanitized, "key_hint")
anyInfo = sanitized
}
other.SetAdmin("channel_affinity", anyInfo)
}
@@ -727,6 +741,9 @@ func RecordChannelAffinity(c *gin.Context, channelID int) {
return
}
setting := operation_setting.GetChannelAffinitySetting()
if RequestPolicy(c).SessionMode == "off" {
return
}
if setting == nil || !setting.Enabled {
return
}