Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions model/channel_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ func GetRandomSatisfiedChannel(group string, model string, retry int) (*Channel,
}
// Calculate the total weight of all channels up to endIdx
totalWeight := sumWeight * smoothingFactor

// totalWeight 小于等于0时,设置为1,选择第一个渠道
if totalWeight <= 0 {
totalWeight = 1
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
// Generate a random value in the range [0, totalWeight)
randomWeight := rand.Intn(totalWeight)

Expand Down