fix(aichat): agent group send

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

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