Skip to content

Commit 8371b81

Browse files
committed
feat(chat): set skip too long to 1024
1 parent dfdf779 commit 8371b81

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

chat/agent.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,15 @@ func logev(ctx *zero.Ctx) {
211211
}
212212
vevent.HookCtxCaller(ctx, vevent.NewAPICallerReturnHook(
213213
ctx, func(req zero.APIRequest, rsp zero.APIResponse, err error) {
214-
if countParamsLength(req.Params) > 256 { // skip too long req&resp
215-
return
216-
}
217214
gid := ctx.Event.GroupID
218215
if gid == 0 {
219216
gid = -ctx.Event.UserID
220217
}
218+
plen := countParamsLength(req.Params)
219+
if plen > 1024 { // skip too long req&resp
220+
logrus.Warnln("[chat] agent", gid, "skip too long requ:", &req)
221+
return
222+
}
221223
ag := AgentOf(ctx.Event.SelfID, "aichat")
222224
logrus.Infoln("[chat] agent", gid, "add requ:", &req)
223225
ag.AddRequest(gid, &req)

0 commit comments

Comments
 (0)