mirror of
https://github.com/fumiama/go-onebot-agent.git
synced 2026-06-23 20:50:35 +08:00
feat: add more log
This commit is contained in:
5
agent.go
5
agent.go
@@ -218,6 +218,7 @@ func (ag *Agent) GetAction(api deepinfra.API, p model.Protocol, grp int64, role
|
|||||||
) {
|
) {
|
||||||
sysp, err := ag.system(role, grp)
|
sysp, err := ag.system(role, grp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Debugln("[goba] GetAction get sysp err:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,6 +226,7 @@ func (ag *Agent) GetAction(api deepinfra.API, p model.Protocol, grp int64, role
|
|||||||
|
|
||||||
resp, err := api.Request(m)
|
resp, err := api.Request(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Debugln("[goba] GetAction request api err:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(resp, "```") { // AI returns codeblock
|
if strings.HasPrefix(resp, "```") { // AI returns codeblock
|
||||||
@@ -239,6 +241,7 @@ func (ag *Agent) GetAction(api deepinfra.API, p model.Protocol, grp int64, role
|
|||||||
r := zero.APIRequest{}
|
r := zero.APIRequest{}
|
||||||
err = dec.Decode(&r)
|
err = dec.Decode(&r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Debugln("[goba] GetAction decode api request err:", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if r.Action == "" {
|
if r.Action == "" {
|
||||||
@@ -260,6 +263,7 @@ func (ag *Agent) GetAction(api deepinfra.API, p model.Protocol, grp int64, role
|
|||||||
}
|
}
|
||||||
txt, err := extractMemory(&r)
|
txt, err := extractMemory(&r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Debugln("[goba] GetAction extract memory err:", err)
|
||||||
ag.AddResponse(grp, &APIResponse{
|
ag.AddResponse(grp, &APIResponse{
|
||||||
Status: "error",
|
Status: "error",
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
@@ -270,6 +274,7 @@ func (ag *Agent) GetAction(api deepinfra.API, p model.Protocol, grp int64, role
|
|||||||
s := "ok"
|
s := "ok"
|
||||||
msg := ""
|
msg := ""
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Debugln("[goba] GetAction add memory err:", err)
|
||||||
s = "error"
|
s = "error"
|
||||||
msg = err.Error()
|
msg = err.Error()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user