Download setting/model_setting/global.go from AZILS/new-api: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/AZILS/new-api/resolve/main/setting/model_setting/global.go
- Command line
-
hf download hf://spaces/AZILS/new-api/setting/model_setting/global.go
-
curl -L -o global.go https://huggingface.co/spaces/AZILS/new-api/resolve/main/setting/model_setting/global.go
1.08 kB
| package model_setting | |
| import ( | |
| "strings" | |
| "github.com/QuantumNous/new-api/setting/config" | |
| ) | |
| type GlobalSettings struct { | |
| PassThroughRequestEnabled bool `json:"pass_through_request_enabled"` | |
| ThinkingModelBlacklist []string `json:"thinking_model_blacklist"` | |
| } | |
| // 默认配置 | |
| var defaultOpenaiSettings = GlobalSettings{ | |
| PassThroughRequestEnabled: false, | |
| ThinkingModelBlacklist: []string{ | |
| "moonshotai/kimi-k2-thinking", | |
| "kimi-k2-thinking", | |
| }, | |
| } | |
| // 全局实例 | |
| var globalSettings = defaultOpenaiSettings | |
| func init() { | |
| // 注册到全局配置管理器 | |
| config.GlobalConfig.Register("global", &globalSettings) | |
| } | |
| func GetGlobalSettings() *GlobalSettings { | |
| return &globalSettings | |
| } | |
| // ShouldPreserveThinkingSuffix 判断模型是否配置为保留 thinking/-nothinking 后缀 | |
| func ShouldPreserveThinkingSuffix(modelName string) bool { | |
| target := strings.TrimSpace(modelName) | |
| if target == "" { | |
| return false | |
| } | |
| for _, entry := range globalSettings.ThinkingModelBlacklist { | |
| if strings.TrimSpace(entry) == target { | |
| return true | |
| } | |
| } | |
| return false | |
| } | |