Commit 0ca336b9 by Calcium-Ion Committed by GitHub

Merge pull request #13 from AI-ASS/main

fix the issue of model repetition
parents 3146624d 745ba3ce
...@@ -14,14 +14,10 @@ type Ability struct { ...@@ -14,14 +14,10 @@ type Ability struct {
} }
func GetGroupModels(group string) []string { func GetGroupModels(group string) []string {
var abilities []Ability var models []string
//去重 enabled = true // Find distinct models
DB.Where("`group` = ? and enabled = ?", group, true).Find(&abilities) DB.Table("abilities").Where("`group` = ? and enabled = ?", group, true).Distinct("model").Pluck("model", &models)
models := make([]string, 0, len(abilities)) return models
for _, ability := range abilities {
models = append(models, ability.Model)
}
return models
} }
func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) { func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment