From 36397fb58336dc165ecddc8ec08830423c36e9cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 6 Jan 2026 23:16:41 +0800 Subject: [PATCH] feat(aichat): force cut multi calls --- plugin/aichat/main.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/plugin/aichat/main.go b/plugin/aichat/main.go index 241c49bd..c055719d 100644 --- a/plugin/aichat/main.go +++ b/plugin/aichat/main.go @@ -110,6 +110,8 @@ func init() { ctx.NoTimeout() logrus.Debugln("[aichat] agent set no timeout") hasresp := false + ispuremsg := false + hassavemem := false for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16 reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), i+1, x, mod, gid, role) if len(reqs) == 0 { @@ -117,10 +119,35 @@ func init() { break } hasresp = true + haseoa := false for _, req := range reqs { if req.Action == goba.SVM { // is a fake action + if hassavemem { + if !haseoa { + ag.AddTerminus(gid) + haseoa = true + logrus.Warnln("[aichat] agent call save mem multi times, force inserting EOA") + } else { + logrus.Warnln("[aichat] agent call save mem multi times, but EOA has been inserted") + } + break + } + hassavemem = true continue } + if req.Action == "send_private_msg" || req.Action == "send_group_msg" { + if ispuremsg { + if !haseoa { + ag.AddTerminus(gid) + haseoa = true + logrus.Warnln("[aichat] agent call send msg multi times, force inserting EOA") + } else { + logrus.Warnln("[aichat] agent call send msg multi times, but EOA has been inserted") + } + break + } + ispuremsg = true + } _ = ctx.CallAction(req.Action, req.Params) } }