Skip to content

Commit 4fd22ee

Browse files
committed
fix(aichat): agent may consume too many tokens
1 parent e4fede7 commit 4fd22ee

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/FloatTech/sqlite v1.7.2
1313
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
1414
github.com/FloatTech/zbpctrl v1.7.1
15-
github.com/FloatTech/zbputils v1.7.2-0.20260111154504-ebb5c08780dd
15+
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c
1616
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
1717
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
1818
github.com/Tnze/go-mc v1.20.2
@@ -27,7 +27,6 @@ require (
2727
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c
2828
github.com/fumiama/go-registry v0.2.7
2929
github.com/fumiama/gotracemoe v0.0.3
30-
github.com/fumiama/imgsz v0.0.4
3130
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
3231
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
3332
github.com/fumiama/terasu v1.0.2
@@ -66,6 +65,7 @@ require (
6665
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
6766
github.com/fumiama/go-simple-protobuf v0.2.0 // indirect
6867
github.com/fumiama/gofastTEA v0.1.3 // indirect
68+
github.com/fumiama/imgsz v0.0.4 // indirect
6969
github.com/fumiama/orbyte v0.0.0-20251002065953-3bb358367eb5 // indirect
7070
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
7171
github.com/go-ole/go-ole v1.2.6 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d h1:mUQ/c3wXKsUGa4Sg9
1616
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
1717
github.com/FloatTech/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
1818
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
19-
github.com/FloatTech/zbputils v1.7.2-0.20260111154504-ebb5c08780dd h1:lCqKcjneDMUdcz8cuyPii3UGLyo2O4XgnO2Ttx1Pjy0=
20-
github.com/FloatTech/zbputils v1.7.2-0.20260111154504-ebb5c08780dd/go.mod h1:yLJvsQJssgQIB4+/uVRNseN4sgFqyfGQLcrKUuXL454=
19+
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c h1:GD96NoftxCVPBs0yewZFb1ynMCF4SmEu9CjrwmZFSbU=
20+
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c/go.mod h1:yLJvsQJssgQIB4+/uVRNseN4sgFqyfGQLcrKUuXL454=
2121
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
2222
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
2323
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=

plugin/aichat/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ func init() {
115115
ctx.NoTimeout()
116116
logrus.Debugln("[aichat] agent set no timeout")
117117
hasresp := false
118-
ispuremsg := false
119-
hassavemem := false
118+
//ispuremsg := false
119+
//hassavemem := false
120120
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
121121
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), i+1, x, mod, gid, role)
122122
if len(reqs) == 0 {
@@ -127,22 +127,22 @@ func init() {
127127
ctx.State[zero.StateKeyPrefixKeep+"_chat_ag_triggered__"] = struct{}{}
128128
for _, req := range reqs {
129129
if req.Action == goba.SVM { // is a fake action
130-
if hassavemem {
130+
/*if hassavemem {
131131
ag.AddTerminus(gid)
132132
logrus.Warnln("[aichat] agent call save mem multi times, force inserting EOA")
133133
return
134134
}
135-
hassavemem = true
135+
hassavemem = true*/
136136
continue
137137
}
138-
if req.Action == "send_private_msg" || req.Action == "send_group_msg" {
138+
/*if req.Action == "send_private_msg" || req.Action == "send_group_msg" {
139139
if ispuremsg {
140140
ag.AddTerminus(gid)
141141
logrus.Warnln("[aichat] agent call send msg multi times, force inserting EOA")
142142
return
143143
}
144144
ispuremsg = true
145-
}
145+
}*/
146146
logrus.Debugln("[chat] agent triggered", gid, "add requ:", &req)
147147
ag.AddRequest(gid, &req)
148148
rsp := ctx.CallAction(req.Action, req.Params)

0 commit comments

Comments
 (0)