初始化导入 new-api 源码

This commit is contained in:
OpenClaw Task Bot
2026-04-09 22:31:14 +08:00
commit 75bda2e845
994 changed files with 250292 additions and 0 deletions

37
setting/auto_group.go Normal file
View File

@@ -0,0 +1,37 @@
package setting
import (
"github.com/QuantumNous/new-api/common"
)
var autoGroups = []string{
"default",
}
var DefaultUseAutoGroup = false
func ContainsAutoGroup(group string) bool {
for _, autoGroup := range autoGroups {
if autoGroup == group {
return true
}
}
return false
}
func UpdateAutoGroupsByJsonString(jsonString string) error {
autoGroups = make([]string, 0)
return common.Unmarshal([]byte(jsonString), &autoGroups)
}
func AutoGroups2JsonString() string {
jsonBytes, err := common.Marshal(autoGroups)
if err != nil {
return "[]"
}
return string(jsonBytes)
}
func GetAutoGroups() []string {
return autoGroups
}