feat: sync deployed v1.0.0-rc.38-custom.42
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 1m40s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 42m16s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s

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 c2b44332d6
commit a5f7b8e586
828 files changed
+122253 -13702

No files matched your search

+21 -7
View File
@@ -58,12 +58,17 @@ func InitChannelCache() {
}
groups := strings.SplitSeq(channel.Group, ",")
for group := range groups {
model2channels, ok := newGroup2model2channels[group]
if !ok {
model2channels = make(map[string][]int)
newGroup2model2channels[group] = model2channels
}
models := channel.GetModels()
for _, model := range models {
if _, ok := newGroup2model2channels[group][model]; !ok {
newGroup2model2channels[group][model] = make([]int, 0)
if _, ok := model2channels[model]; !ok {
model2channels[model] = make([]int, 0)
}
newGroup2model2channels[group][model] = append(newGroup2model2channels[group][model], channel.Id)
model2channels[model] = append(model2channels[model], channel.Id)
}
}
}
@@ -119,22 +124,31 @@ func GetRandomSatisfiedChannel(
model string,
retry int,
filters []dto.ChannelFilter,
) (*Channel, error) {
traces ...*SelectionTrace,
) (selected *Channel, err error) {
var trace *SelectionTrace
if len(traces) > 0 {
trace = traces[0]
}
// if memory cache is disabled, get channel directly from database
if !common.MemoryCacheEnabled {
return GetChannel(group, model, retry, filters)
defer func() { trace.Finish(selected) }()
return GetChannel(group, model, retry, filters, trace)
}
channelSyncLock.RLock()
defer channelSyncLock.RUnlock()
defer func() { trace.Finish(selected) }()
// First, try to find channels with the exact model name.
channels, _ := filterCandidateIDs(group2model2channels[group][model], model, filters)
channels, _ := filterCandidateIDsObserved(group2model2channels[group][model], model, filters, trace, group)
// If no channels found, try to find channels with the normalized model name.
if len(channels) == 0 {
normalizedModel := ratio_setting.RoutingMatchModelName(model)
channels, _ = filterCandidateIDs(group2model2channels[group][normalizedModel], model, filters)
if normalizedModel != model {
channels, _ = filterCandidateIDsObserved(group2model2channels[group][normalizedModel], model, filters, trace, group)
}
}
if len(channels) == 0 {