feat(aichat): add terminus

This commit is contained in:
源文雨
2025-09-26 00:37:44 +08:00
parent 43cc90b724
commit f7c0f4df98
3 changed files with 10 additions and 3 deletions

View File

@@ -122,11 +122,18 @@ func init() {
ag.SetViewImageAPI(deepinfra.NewAPI(cfg.ImageAPI, string(cfg.ImageKey)), mod)
}
ctx.NoTimeout()
hasresp := false
defer func() {
if hasresp {
ag.AddTerminus(gid)
}
}()
for i := 0; i < 8; i++ { // 最大运行 8 轮因为问答上下文只有 16
reqs := chat.CallAgent(ag, zero.SuperUserPermission(ctx), x, mod, gid, role)
if len(reqs) == 0 {
return
}
hasresp = true
for _, req := range reqs {
resp := ctx.CallAction(req.Action, req.Params)
logrus.Infoln("[aichat] agent get resp:", reqs)