| 1234567891011121314151617181920212223242526272829303132 |
- package constant
- import "strings"
- var CheckSensitiveEnabled = true
- var CheckSensitiveOnPromptEnabled = true
- var CheckSensitiveOnCompletionEnabled = true
- // StopOnSensitiveEnabled 如果检测到敏感词,是否立刻停止生成,否则替换敏感词
- var StopOnSensitiveEnabled = true
- // SensitiveWords 敏感词
- // var SensitiveWords []string
- var SensitiveWords = []string{
- "test",
- }
- func SensitiveWordsToString() string {
- return strings.Join(SensitiveWords, "\n")
- }
- func SensitiveWordsFromString(s string) {
- SensitiveWords = strings.Split(s, "\n")
- }
- func ShouldCheckPromptSensitive() bool {
- return CheckSensitiveEnabled && CheckSensitiveOnPromptEnabled
- }
- func ShouldCheckCompletionSensitive() bool {
- return CheckSensitiveEnabled && CheckSensitiveOnCompletionEnabled
- }
|