Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta44 #45

Merged
merged 45 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ea4bcc6
beta1
Hoshinonyaruko Jan 21, 2024
5002a28
beta2
Hoshinonyaruko Jan 21, 2024
969841e
beta3
Hoshinonyaruko Jan 21, 2024
a2989c2
beta4
Hoshinonyaruko Jan 21, 2024
611cd8b
beta5
Hoshinonyaruko Jan 21, 2024
dbad42b
beta6
Hoshinonyaruko Jan 21, 2024
4f8895e
beta7
Hoshinonyaruko Jan 21, 2024
30a9cab
beta8
Hoshinonyaruko Jan 21, 2024
461d879
beta9
Hoshinonyaruko Jan 21, 2024
c90c2ee
beta10
Hoshinonyaruko Jan 21, 2024
5227c32
beta11
Hoshinonyaruko Jan 21, 2024
8e14e56
beta12
Hoshinonyaruko Jan 21, 2024
6adfb7f
beta13
Hoshinonyaruko Jan 21, 2024
b04f6c0
beta14
Hoshinonyaruko Jan 21, 2024
649e740
beta15
Hoshinonyaruko Jan 21, 2024
d55cf29
beta16
Hoshinonyaruko Jan 21, 2024
1cc351e
beta16
Hoshinonyaruko Jan 21, 2024
f1a373e
beta19
Hoshinonyaruko Jan 21, 2024
cbf2fe1
beta20
Hoshinonyaruko Jan 21, 2024
3485bfc
beta21
Hoshinonyaruko Jan 21, 2024
3e3bb1a
beta22
Hoshinonyaruko Jan 21, 2024
2e4f3fa
beta23
Hoshinonyaruko Mar 29, 2024
f74075d
beta24
Hoshinonyaruko Mar 29, 2024
f3913cf
beta25
Hoshinonyaruko Mar 29, 2024
4cfb51a
beta27
Hoshinonyaruko Mar 30, 2024
d9b26c0
beta28
Hoshinonyaruko Mar 31, 2024
19da709
beta29
Hoshinonyaruko Mar 31, 2024
e06dcbf
merge
Hoshinonyaruko Mar 31, 2024
c76923e
beta30
Hoshinonyaruko Mar 31, 2024
9ae21da
beta31
Hoshinonyaruko Apr 1, 2024
4f333bc
merge
Hoshinonyaruko Apr 1, 2024
5acba8f
beta33
Hoshinonyaruko Apr 1, 2024
c637fcd
beta34
Hoshinonyaruko Apr 1, 2024
4e85b37
beta35
Hoshinonyaruko Apr 1, 2024
970948e
beta36
Hoshinonyaruko Apr 1, 2024
14271c3
beta37
Hoshinonyaruko Apr 1, 2024
6154d1a
beta38
Hoshinonyaruko Apr 1, 2024
d5be5e6
beta39
Hoshinonyaruko Apr 3, 2024
54afe18
beta40
Hoshinonyaruko Apr 3, 2024
0b71855
beta41
Hoshinonyaruko Apr 3, 2024
8c5f9a3
merge
Hoshinonyaruko Apr 3, 2024
cf752d4
beta42
Hoshinonyaruko Apr 3, 2024
3698824
beta43
Hoshinonyaruko Apr 3, 2024
1e9c189
beta44
Hoshinonyaruko Apr 3, 2024
c8c9c97
Merge branch 'main' into beta44
Hoshinonyaruko Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion applogic/gensokyo.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {

// 向量安全词部分,机器人大安全向量安全屏障
if config.GetVectorSensitiveFilter() {
ret, err, retstr := app.InterceptSensitiveContent(vector, message)
ret, retstr, err := app.InterceptSensitiveContent(vector, message)
if err != nil {
fmtf.Printf("Error in InterceptSensitiveContent: %v", err)
// 发送响应
Expand Down Expand Up @@ -525,6 +525,11 @@ func (app *App) GensokyoHandler(w http.ResponseWriter, r *http.Request) {
}
}

// OUT规则不仅对实际发送api生效,也对http结果生效
if config.GetSensitiveModeType() == 1 {
response = acnode.CheckWordOUT(response)
}

// 发送响应
w.WriteHeader(http.StatusOK)
w.Write([]byte("Request received and processed Q:" + newmsg + " A:" + response))
Expand Down
8 changes: 4 additions & 4 deletions applogic/vectorsensitive.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ func (app *App) textExistsInDatabase(text string) (bool, error) {
return exists, nil
}

func (app *App) InterceptSensitiveContent(vector []float64, message structs.OnebotGroupMessage) (int, error, string) {
func (app *App) InterceptSensitiveContent(vector []float64, message structs.OnebotGroupMessage) (int, string, error) {
// 自定义阈值
Threshold := config.GetVertorSensitiveThreshold()

// 进行搜索
results, _, err := app.searchForSingleVectorSensitive(vector, Threshold)
if err != nil {
return 1, fmtf.Errorf("error searching for sensitive content: %w", err), ""
return 1, "", fmtf.Errorf("error searching for sensitive content: %w", err)
}

// 输出搜索到的result数组
Expand All @@ -208,12 +208,12 @@ func (app *App) InterceptSensitiveContent(vector []float64, message structs.Oneb
} else {
utils.SendGroupMessage(message.GroupID, saveresponse)
}
return 1, nil, saveresponse
return 1, saveresponse, nil
}
} else {
// 未匹配到敏感内容
fmtf.Println("No sensitive content detected.")
}

return 0, nil, ""
return 0, "", nil
}
Loading