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

+43 -2
View File
@@ -8,8 +8,10 @@ import (
)
var filterEvalOrder = []dto.ChannelFilterKind{
dto.FilterAttemptedChannel,
dto.FilterRequestPath,
dto.FilterTaskPluginIdentity,
dto.FilterResponsesWebSocket,
}
// ChannelSatisfiesFilters reports whether ch passes every filter.
@@ -37,6 +39,27 @@ func ChannelSatisfiesFilters(ch *Channel, modelName string, filters []dto.Channe
// A missing id in channelsIDM is kept for request_path (downstream consistency
// error) and dropped for task_plugin_identity, matching the previous filters.
func filterCandidateIDs(ids []int, modelName string, filters []dto.ChannelFilter) (kept []int, emptiedBy dto.ChannelFilterKind) {
return filterCandidateIDsObserved(ids, modelName, filters, nil, "")
}
func filterCandidateIDsObserved(ids []int, modelName string, filters []dto.ChannelFilter, trace *SelectionTrace, group string) (kept []int, emptiedBy dto.ChannelFilterKind) {
if trace != nil {
for _, id := range ids {
ch, exists := channelsIDM[id]
reason := "eligible"
for _, kind := range filterEvalOrder {
fs := filtersByKind(filters, kind)
if len(fs) > 0 && !candidatePassesKindFilters(ch, exists, modelName, kind, fs) {
reason = "excluded_" + string(kind)
break
}
}
if !exists {
reason = "missing_channel"
}
trace.Add(ch, id, group, modelName, reason)
}
}
if len(ids) == 0 {
return ids, ""
}
@@ -88,20 +111,38 @@ func candidatePassesKindFilters(ch *Channel, exists bool, modelName string, kind
func channelMatchesFilter(ch *Channel, modelName string, filter dto.ChannelFilter) bool {
switch filter.Kind {
case dto.FilterAttemptedChannel:
return !slices.Contains(filter.ExcludedChannelIDs, ch.Id)
case dto.FilterRequestPath:
if filter.RequestPath == "" {
return true
}
if ch.Type != constant.ChannelTypeAdvancedCustom {
if !constant.IsAdvancedCustomChannel(ch.Type) {
return true
}
config := ch.GetOtherSettings().AdvancedCustom
return config != nil && config.SupportsPathForModel(filter.RequestPath, modelName)
case dto.FilterTaskPluginIdentity:
if ch.Type == constant.ChannelTypeTaskPlugin {
return filter.TaskPluginKey != "" && ch.GetSetting().TaskPluginKey == filter.TaskPluginKey
key := ch.GetSetting().TaskPluginKey
return filter.TaskPluginKey != "" && (key == filter.TaskPluginKey || slices.Contains(filter.TaskPluginKeys, key))
}
return filter.TaskPluginKey == "" || slices.Contains(filter.TaskPluginChannelTypes, ch.Type)
case dto.FilterResponsesWebSocket:
if !ch.GetSetting().ResponsesWebSocketEnabled {
return false
}
switch ch.Type {
case constant.ChannelTypeOpenAI, constant.ChannelTypeCodex, constant.ChannelTypeSub2API, constant.ChannelTypeNewAPI:
return true
case constant.ChannelTypeAdvancedCustom:
// The session forwards native Responses events without protocol
// conversion, so only a converter-free /v1/responses route qualifies.
route, ok := ch.GetOtherSettings().AdvancedCustom.MatchPathForModel("/v1/responses", modelName)
return ok && route.IsNative()
default:
return false
}
default:
return true
}