mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-20 09:16:37 +08:00
fix: fix error
This commit is contained in:
parent
2db4282666
commit
47b9f48544
@ -56,7 +56,7 @@ func OpenaiStreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*d
|
||||
sensitive := false
|
||||
if checkSensitive {
|
||||
// check sensitive
|
||||
sensitive, _, data = service.SensitiveWordReplace(data, constant.StopOnSensitiveEnabled)
|
||||
sensitive, _, data = service.SensitiveWordReplace(data, false)
|
||||
}
|
||||
dataChan <- data
|
||||
data = data[6:]
|
||||
|
@ -25,9 +25,9 @@ func SensitiveWordContains(text string) (bool, []string) {
|
||||
|
||||
// SensitiveWordReplace 敏感词替换,返回是否包含敏感词和替换后的文本
|
||||
func SensitiveWordReplace(text string, returnImmediately bool) (bool, []string, string) {
|
||||
text = strings.ToLower(text)
|
||||
checkText := strings.ToLower(text)
|
||||
m := initAc()
|
||||
hits := m.MultiPatternSearch([]rune(text), returnImmediately)
|
||||
hits := m.MultiPatternSearch([]rune(checkText), returnImmediately)
|
||||
if len(hits) > 0 {
|
||||
words := make([]string, 0)
|
||||
for _, hit := range hits {
|
||||
|
Loading…
Reference in New Issue
Block a user