MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / getChannelQuery

Function getChannelQuery

model/ability.go:90–103  ·  view source on GitHub ↗
(group string, model string, retry int)

Source from the content-addressed store, hash-verified

88}
89
90func getChannelQuery(group string, model string, retry int) (*gorm.DB, error) {
91 maxPrioritySubQuery := DB.Model(&Ability{}).Select("MAX(priority)").Where(commonGroupCol+" = ? and model = ? and enabled = ?", group, model, true)
92 channelQuery := DB.Where(commonGroupCol+" = ? and model = ? and enabled = ? and priority = (?)", group, model, true, maxPrioritySubQuery)
93 if retry != 0 {
94 priority, err := getPriority(group, model, retry)
95 if err != nil {
96 return nil, err
97 } else {
98 channelQuery = DB.Where(commonGroupCol+" = ? and model = ? and enabled = ? and priority = ?", group, model, true, priority)
99 }
100 }
101
102 return channelQuery, nil
103}
104
105// 修改GetRandomSatisfiedChannel函数,添加渠道标签过滤参数
106func GetRandomSatisfiedChannel(group string, model string, retry int, channelTag *string) (*Channel, error) {

Callers 1

Calls 1

getPriorityFunction · 0.85

Tested by

no test coverage detected