mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-01-18 06:10:31 +00:00
fix(aichat): agent may consume too many tokens
This commit is contained in:
parent
e4fede7a75
commit
4fd22ee7c7
4
go.mod
4
go.mod
@ -12,7 +12,7 @@ require (
|
|||||||
github.com/FloatTech/sqlite v1.7.2
|
github.com/FloatTech/sqlite v1.7.2
|
||||||
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
|
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
|
||||||
github.com/FloatTech/zbpctrl v1.7.1
|
github.com/FloatTech/zbpctrl v1.7.1
|
||||||
github.com/FloatTech/zbputils v1.7.2-0.20260111154504-ebb5c08780dd
|
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c
|
||||||
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
|
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
|
||||||
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
|
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
|
||||||
github.com/Tnze/go-mc v1.20.2
|
github.com/Tnze/go-mc v1.20.2
|
||||||
@ -27,7 +27,6 @@ require (
|
|||||||
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c
|
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c
|
||||||
github.com/fumiama/go-registry v0.2.7
|
github.com/fumiama/go-registry v0.2.7
|
||||||
github.com/fumiama/gotracemoe v0.0.3
|
github.com/fumiama/gotracemoe v0.0.3
|
||||||
github.com/fumiama/imgsz v0.0.4
|
|
||||||
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
|
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
|
||||||
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
|
github.com/fumiama/slowdo v0.0.0-20241001074058-27c4fe5259a4
|
||||||
github.com/fumiama/terasu v1.0.2
|
github.com/fumiama/terasu v1.0.2
|
||||||
@ -66,6 +65,7 @@ require (
|
|||||||
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
|
github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect
|
||||||
github.com/fumiama/go-simple-protobuf v0.2.0 // indirect
|
github.com/fumiama/go-simple-protobuf v0.2.0 // indirect
|
||||||
github.com/fumiama/gofastTEA v0.1.3 // indirect
|
github.com/fumiama/gofastTEA v0.1.3 // indirect
|
||||||
|
github.com/fumiama/imgsz v0.0.4 // indirect
|
||||||
github.com/fumiama/orbyte v0.0.0-20251002065953-3bb358367eb5 // indirect
|
github.com/fumiama/orbyte v0.0.0-20251002065953-3bb358367eb5 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -16,8 +16,8 @@ github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d h1:mUQ/c3wXKsUGa4Sg9
|
|||||||
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
||||||
github.com/FloatTech/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
|
github.com/FloatTech/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
|
||||||
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
|
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
|
||||||
github.com/FloatTech/zbputils v1.7.2-0.20260111154504-ebb5c08780dd h1:lCqKcjneDMUdcz8cuyPii3UGLyo2O4XgnO2Ttx1Pjy0=
|
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c h1:GD96NoftxCVPBs0yewZFb1ynMCF4SmEu9CjrwmZFSbU=
|
||||||
github.com/FloatTech/zbputils v1.7.2-0.20260111154504-ebb5c08780dd/go.mod h1:yLJvsQJssgQIB4+/uVRNseN4sgFqyfGQLcrKUuXL454=
|
github.com/FloatTech/zbputils v1.7.2-0.20260117035520-ab3ea04ef68c/go.mod h1:yLJvsQJssgQIB4+/uVRNseN4sgFqyfGQLcrKUuXL454=
|
||||||
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
|
||||||
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
|
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
|
||||||
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
|
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
|
||||||
|
|||||||
@ -115,8 +115,8 @@ func init() {
|
|||||||
ctx.NoTimeout()
|
ctx.NoTimeout()
|
||||||
logrus.Debugln("[aichat] agent set no timeout")
|
logrus.Debugln("[aichat] agent set no timeout")
|
||||||
hasresp := false
|
hasresp := false
|
||||||
ispuremsg := false
|
//ispuremsg := false
|
||||||
hassavemem := false
|
//hassavemem := false
|
||||||
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
|
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
|
||||||
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), i+1, x, mod, gid, role)
|
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), i+1, x, mod, gid, role)
|
||||||
if len(reqs) == 0 {
|
if len(reqs) == 0 {
|
||||||
@ -127,22 +127,22 @@ func init() {
|
|||||||
ctx.State[zero.StateKeyPrefixKeep+"_chat_ag_triggered__"] = struct{}{}
|
ctx.State[zero.StateKeyPrefixKeep+"_chat_ag_triggered__"] = struct{}{}
|
||||||
for _, req := range reqs {
|
for _, req := range reqs {
|
||||||
if req.Action == goba.SVM { // is a fake action
|
if req.Action == goba.SVM { // is a fake action
|
||||||
if hassavemem {
|
/*if hassavemem {
|
||||||
ag.AddTerminus(gid)
|
ag.AddTerminus(gid)
|
||||||
logrus.Warnln("[aichat] agent call save mem multi times, force inserting EOA")
|
logrus.Warnln("[aichat] agent call save mem multi times, force inserting EOA")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hassavemem = true
|
hassavemem = true*/
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if req.Action == "send_private_msg" || req.Action == "send_group_msg" {
|
/*if req.Action == "send_private_msg" || req.Action == "send_group_msg" {
|
||||||
if ispuremsg {
|
if ispuremsg {
|
||||||
ag.AddTerminus(gid)
|
ag.AddTerminus(gid)
|
||||||
logrus.Warnln("[aichat] agent call send msg multi times, force inserting EOA")
|
logrus.Warnln("[aichat] agent call send msg multi times, force inserting EOA")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ispuremsg = true
|
ispuremsg = true
|
||||||
}
|
}*/
|
||||||
logrus.Debugln("[chat] agent triggered", gid, "add requ:", &req)
|
logrus.Debugln("[chat] agent triggered", gid, "add requ:", &req)
|
||||||
ag.AddRequest(gid, &req)
|
ag.AddRequest(gid, &req)
|
||||||
rsp := ctx.CallAction(req.Action, req.Params)
|
rsp := ctx.CallAction(req.Action, req.Params)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user