mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
feat(aichat): add terminus
This commit is contained in:
parent
43cc90b724
commit
f7c0f4df98
2
go.mod
2
go.mod
@ -24,7 +24,7 @@ require (
|
|||||||
github.com/fumiama/cron v1.3.0
|
github.com/fumiama/cron v1.3.0
|
||||||
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa
|
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa
|
||||||
github.com/fumiama/go-base16384 v1.7.0
|
github.com/fumiama/go-base16384 v1.7.0
|
||||||
github.com/fumiama/go-onebot-agent v0.0.0-20250925150209-46ace7c2b17a
|
github.com/fumiama/go-onebot-agent v0.0.0-20250925163239-0ede409f6187
|
||||||
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/jieba v0.0.0-20221203025406-36c17a10b565
|
github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -63,8 +63,8 @@ github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa h1:UMMNejpPp8dn9
|
|||||||
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
|
github.com/fumiama/deepinfra v0.0.0-20250924162107-cf156d49a0fa/go.mod h1:uqsWK/GM9OvKV0pXZOQB63rWugBbiXInY8E1JoRKhkg=
|
||||||
github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA=
|
github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA=
|
||||||
github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
|
github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM=
|
||||||
github.com/fumiama/go-onebot-agent v0.0.0-20250925150209-46ace7c2b17a h1:PapkA1fkFCzBbcmFaxRQvRAHbRig3NIgstzG7OFcXjQ=
|
github.com/fumiama/go-onebot-agent v0.0.0-20250925163239-0ede409f6187 h1:kO+Ye7JdQLiUXpDqcBFOMeg5wmPovemTS/khlN+n+tU=
|
||||||
github.com/fumiama/go-onebot-agent v0.0.0-20250925150209-46ace7c2b17a/go.mod h1:FIhZxVeFAs201W06EgXxx/6b/l/ETSmu2sQOj10kjdk=
|
github.com/fumiama/go-onebot-agent v0.0.0-20250925163239-0ede409f6187/go.mod h1:FIhZxVeFAs201W06EgXxx/6b/l/ETSmu2sQOj10kjdk=
|
||||||
github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs=
|
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-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs=
|
||||||
github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=
|
github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o=
|
||||||
|
|||||||
@ -122,11 +122,18 @@ func init() {
|
|||||||
ag.SetViewImageAPI(deepinfra.NewAPI(cfg.ImageAPI, string(cfg.ImageKey)), mod)
|
ag.SetViewImageAPI(deepinfra.NewAPI(cfg.ImageAPI, string(cfg.ImageKey)), mod)
|
||||||
}
|
}
|
||||||
ctx.NoTimeout()
|
ctx.NoTimeout()
|
||||||
|
hasresp := false
|
||||||
|
defer func() {
|
||||||
|
if hasresp {
|
||||||
|
ag.AddTerminus(gid)
|
||||||
|
}
|
||||||
|
}()
|
||||||
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
|
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
|
||||||
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), x, mod, gid, role)
|
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), x, mod, gid, role)
|
||||||
if len(reqs) == 0 {
|
if len(reqs) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
hasresp = true
|
||||||
for _, req := range reqs {
|
for _, req := range reqs {
|
||||||
resp := ctx.CallAction(req.Action, req.Params)
|
resp := ctx.CallAction(req.Action, req.Params)
|
||||||
logrus.Infoln("[aichat] agent get resp:", reqs)
|
logrus.Infoln("[aichat] agent get resp:", reqs)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user