Based on QuantumNous/new-api v1.0.0-rc.36 (shallow history squashed). - CNY quota display mode: RMB-denominated top-up and crediting across Epay/Waffo channels - New CheckinButton in both authenticated and public headers (Turnstile supported) - New /subscribe page with public plan snapshot, Alipay/balance payment, auto group upgrade/reset - New /docs 12-section beginner guide with anchor navigation - New home PromoBanner linking to /docs; i18n synced (en/zh/zh-TW/fr/ja/ru/vi) - README: document custom features, live demo https://ai.88531.cn
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package setting
|
|
|
|
import "strings"
|
|
|
|
var CheckSensitiveEnabled = true
|
|
var CheckSensitiveOnPromptEnabled = true
|
|
|
|
//var CheckSensitiveOnCompletionEnabled = true
|
|
|
|
// StopOnSensitiveEnabled 如果检测到敏感词,是否立刻停止生成,否则替换敏感词
|
|
var StopOnSensitiveEnabled = true
|
|
|
|
// StreamCacheQueueLength 流模式缓存队列长度,0表示无缓存
|
|
var StreamCacheQueueLength = 0
|
|
|
|
// SensitiveWords 敏感词
|
|
// var SensitiveWords []string
|
|
var SensitiveWords = []string{
|
|
"test_sensitive",
|
|
}
|
|
|
|
func SensitiveWordsToString() string {
|
|
return strings.Join(SensitiveWords, "\n")
|
|
}
|
|
|
|
func SensitiveWordsFromString(s string) {
|
|
SensitiveWords = []string{}
|
|
sw := strings.SplitSeq(s, "\n")
|
|
for w := range sw {
|
|
w = strings.TrimSpace(w)
|
|
if w != "" {
|
|
SensitiveWords = append(SensitiveWords, w)
|
|
}
|
|
}
|
|
}
|
|
|
|
func ShouldCheckPromptSensitive() bool {
|
|
return CheckSensitiveEnabled && CheckSensitiveOnPromptEnabled
|
|
}
|
|
|
|
//func ShouldCheckCompletionSensitive() bool {
|
|
// return CheckSensitiveEnabled && CheckSensitiveOnCompletionEnabled
|
|
//}
|