Compare commits

...

4 Commits

Author SHA1 Message Date
github-actions[bot]
6d30750f42 chore(nix): bump deps (#1257)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-07 00:47:03 +08:00
源文雨
78e1aa6783 feat(aichat): force cut multi calls 2026-01-07 00:45:12 +08:00
源文雨
9bfaa0c195 feat(aichat): force cut multi calls 2026-01-06 23:29:48 +08:00
源文雨
36397fb583 feat(aichat): force cut multi calls 2026-01-06 23:16:41 +08:00
4 changed files with 40 additions and 11 deletions

4
go.mod
View File

@@ -12,7 +12,7 @@ require (
github.com/FloatTech/sqlite v1.7.2
github.com/FloatTech/ttl v0.0.0-20250224045156-012b1463287d
github.com/FloatTech/zbpctrl v1.7.1
github.com/FloatTech/zbputils v1.7.2-0.20260106142643-d2d50560ae97
github.com/FloatTech/zbputils v1.7.2-0.20260106163901-1f0a51ecf35d
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
github.com/RomiChan/websocket v1.4.3-0.20251002072000-d3eb41798438
github.com/Tnze/go-mc v1.20.2
@@ -24,7 +24,7 @@ require (
github.com/fumiama/cron v1.3.0
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a
github.com/fumiama/go-base16384 v1.7.1
github.com/fumiama/go-onebot-agent v0.0.0-20260106141737-1ac01594b67f
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c
github.com/fumiama/go-registry v0.2.7
github.com/fumiama/gotracemoe v0.0.3
github.com/fumiama/imgsz v0.0.4

8
go.sum
View File

@@ -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/zbpctrl v1.7.1 h1:0yPEmCForhyMbnhTckmjDUFFDZgQp1RjO2bVF4ZVqOs=
github.com/FloatTech/zbpctrl v1.7.1/go.mod h1:xmM4dSwHA02Gei3ogCRiG+RTrw/7Z69PfrN5NYf8BPE=
github.com/FloatTech/zbputils v1.7.2-0.20260106142643-d2d50560ae97 h1:lmlg7nKGbr/+rwPFZ98z5IetB4ooTFZFyd1ovzd1gA4=
github.com/FloatTech/zbputils v1.7.2-0.20260106142643-d2d50560ae97/go.mod h1:K80JcDL2x1rqsyOzMPSIqqqSiJncWwlPIgHcNXnYIAw=
github.com/FloatTech/zbputils v1.7.2-0.20260106163901-1f0a51ecf35d h1:Ur2R0bWD88qbY6lgEQ21QojZ7ErQRWDHz4RA4NNX8gw=
github.com/FloatTech/zbputils v1.7.2-0.20260106163901-1f0a51ecf35d/go.mod h1:O3Js6obaao6BhxHx7hl1xwup4jXm/Fk2cmZEg5qNur8=
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/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
@@ -67,8 +67,8 @@ github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a h1:a0+2vaXajfxsN
github.com/fumiama/deepinfra v0.0.0-20251221163610-e98ee3ba437a/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
github.com/fumiama/go-base16384 v1.7.1 h1:1P1x6FWRvd7PtbH4idDAGWAjKKcVxggxlROYKRXbw58=
github.com/fumiama/go-base16384 v1.7.1/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
github.com/fumiama/go-onebot-agent v0.0.0-20260106141737-1ac01594b67f h1:U6/IW2KL7xeAlIjV6MJTXMqmzcJaMXi43S4zXjIv+3s=
github.com/fumiama/go-onebot-agent v0.0.0-20260106141737-1ac01594b67f/go.mod h1:rTrS23rvTYuZcSngENJTvcBFTz1nGsImSv+bW7yfhqs=
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c h1:kCAFF41GkJklKvftchjuEpo4Mp/qUSiEGBeChs4QJdk=
github.com/fumiama/go-onebot-agent v0.0.0-20260106161505-f7d25272034c/go.mod h1:rTrS23rvTYuZcSngENJTvcBFTz1nGsImSv+bW7yfhqs=
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=
github.com/fumiama/go-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs=
github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=

View File

@@ -29,8 +29,8 @@ schema = 3
version = "v1.7.1"
hash = "sha256-wkeiaUTpPVbpH7fcXeoLtG+aGIMJbvoc/9sbi2IXK0I="
[mod."github.com/FloatTech/zbputils"]
version = "v1.7.2-0.20260104162610-89522e42ecca"
hash = "sha256-xvv7VHQ1XaYTP4+eCT6bZ6Zq48IWoqsYCBIGPk1P5sw="
version = "v1.7.2-0.20260106163901-1f0a51ecf35d"
hash = "sha256-Tb4X/usnhiNKaArlp96+KTKOdM4DK0SUZLHo8TlXi/c="
[mod."github.com/PuerkitoBio/goquery"]
version = "v1.8.0"
hash = "sha256-I3QaPWATvBOL/F26fIiYWKS13yBUYo+9o3tcsGIu8tY="
@@ -92,8 +92,8 @@ schema = 3
version = "v1.7.1"
hash = "sha256-Fd1QaeYx+3q4C3XQXlPFnDmKPsoZH6837fN/7rn8i9s="
[mod."github.com/fumiama/go-onebot-agent"]
version = "v0.0.0-20260104164334-63ab0bc7f53a"
hash = "sha256-t+jnemW581ehzDklZ8+CO9uQN3jaww6nefXSuVuFZpQ="
version = "v0.0.0-20260106161505-f7d25272034c"
hash = "sha256-+bu2VbZVwS7SDgfx53aZjQxSRtrXFi+g0Jn8W9w6QQ8="
[mod."github.com/fumiama/go-registry"]
version = "v0.2.7"
hash = "sha256-Rjl+z0Hlp2LMi8+pnFe5HrxctyHMi7UPiK33g/OgLdA="

View File

@@ -110,8 +110,23 @@ func init() {
ctx.NoTimeout()
logrus.Debugln("[aichat] agent set no timeout")
hasresp := false
ispuremsg := false
hassavemem := false
var (
reqs []zero.APIRequest
cl func()
)
defer func() {
if cl != nil {
cl()
}
}()
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), i+1, x, mod, gid, role)
reqs, cl = chat.CallAgent(ag, zero.SuperUserPermission(ctx), i+1, x, mod, gid, role)
if cl != nil {
cl()
cl = nil
}
if len(reqs) == 0 {
logrus.Debugln("[aichat] agent call got empty response")
break
@@ -119,8 +134,22 @@ func init() {
hasresp = true
for _, req := range reqs {
if req.Action == goba.SVM { // is a fake action
if hassavemem {
ag.AddTerminus(gid)
logrus.Warnln("[aichat] agent call save mem multi times, force inserting EOA")
return
}
hassavemem = true
continue
}
if req.Action == "send_private_msg" || req.Action == "send_group_msg" {
if ispuremsg {
ag.AddTerminus(gid)
logrus.Warnln("[aichat] agent call send msg multi times, force inserting EOA")
return
}
ispuremsg = true
}
_ = ctx.CallAction(req.Action, req.Params)
}
}