fix(aichat): agent group send
Some checks are pending
自动更新 nix 依赖 / gomod2nix update (push) Waiting to run
打包最新版为 Docker Image / build docker (push) Waiting to run
最新版 / Build binary CI (386, linux) (push) Waiting to run
最新版 / Build binary CI (386, windows) (push) Waiting to run
最新版 / Build binary CI (amd64, linux) (push) Waiting to run
最新版 / Build binary CI (amd64, windows) (push) Waiting to run
最新版 / Build binary CI (arm, linux) (push) Waiting to run
最新版 / Build binary CI (arm64, linux) (push) Waiting to run
PushLint / lint (push) Waiting to run

This commit is contained in:
源文雨 2025-09-22 23:55:40 +08:00
parent 8e87be262c
commit 73eef961b5
3 changed files with 12 additions and 7 deletions

2
go.mod
View File

@ -24,7 +24,7 @@ require (
github.com/fumiama/cron v1.3.0
github.com/fumiama/deepinfra v0.0.0-20250920170049-e3d1b92cc3a1
github.com/fumiama/go-base16384 v1.7.0
github.com/fumiama/go-onebot-agent v0.0.0-20250922144028-320c6b821c49
github.com/fumiama/go-onebot-agent v0.0.0-20250922152742-c40bb3512d63
github.com/fumiama/go-registry v0.2.7
github.com/fumiama/gotracemoe v0.0.3
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565

4
go.sum
View File

@ -63,8 +63,8 @@ github.com/fumiama/deepinfra v0.0.0-20250920170049-e3d1b92cc3a1 h1:6PglFpNVm3Dal
github.com/fumiama/deepinfra v0.0.0-20250920170049-e3d1b92cc3a1/go.mod h1:wW05PQSn8mo1mZIoa6LBUE+3xIBjkoONvnfPTV5ZOhY=
github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA=
github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
github.com/fumiama/go-onebot-agent v0.0.0-20250922144028-320c6b821c49 h1:5Z+Ljv17X4i/PthL7eVfXq+CKlOnboRlPZeG7Nngyyk=
github.com/fumiama/go-onebot-agent v0.0.0-20250922144028-320c6b821c49/go.mod h1:wVMgFWkR3GpipL05FkokvrV/jWFIgoEWN1jzUGa0bWg=
github.com/fumiama/go-onebot-agent v0.0.0-20250922152742-c40bb3512d63 h1:ZdPMPIgZMH4HV4A/JIBb8G7UpLM4iUHWQ8qGjKnKiVI=
github.com/fumiama/go-onebot-agent v0.0.0-20250922152742-c40bb3512d63/go.mod h1:wVMgFWkR3GpipL05FkokvrV/jWFIgoEWN1jzUGa0bWg=
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=
github.com/fumiama/go-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs=
github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=

View File

@ -2,6 +2,7 @@
package aichat
import (
"encoding/json"
"errors"
"math/rand"
"reflect"
@ -161,12 +162,16 @@ func init() {
logrus.Infoln("[aichat] agent do:", reqs)
for _, req := range reqs {
if req.Action == "send_group_msg" {
v := reflect.ValueOf(req.Params["group_id"])
if !v.CanInt() {
logrus.Warnln("[aichat] invalid", req.Action, req.Params)
v, ok := req.Params["group_id"].(json.Number)
if !ok {
logrus.Warnln("[aichat] invalid group_id type", reflect.TypeOf(req.Params["group_id"]))
continue
}
gid, err = v.Int64()
if !ok {
logrus.Warnln("[aichat] agent conv req gid err:", err)
continue
}
gid = v.Int()
if ctx.Event.GroupID != gid && !zero.SuperUserPermission(ctx) {
logrus.Warnln("[aichat] refuse to send out of grp from", ctx.Event.GroupID, "to", gid)
continue