Skip to content

Commit ff0902a

Browse files
committed
fix(chat): agent error on other's trigger
1 parent 8371b81 commit ff0902a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

chat/agent.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ func CallAgent(ag *goba.Agent, issudo bool, iter int, api deepinfra.API, p model
119119
continue
120120
}
121121
if role == goba.PermRoleUser { // check @all
122-
msg, ok := req.Params["message"].(string)
123-
if !ok {
124-
logrus.Warnln("[chat] invalid message type", reflect.TypeOf(req.Params["message"]))
122+
msgb, err := json.Marshal(req.Params["message"])
123+
if err != nil {
124+
logrus.Warnln("[chat] re-marshal msg err:", err)
125125
continue
126126
}
127-
msgs := message.ParseMessageFromArray(gjson.Parse(msg))
127+
msgs := message.ParseMessageFromArray(gjson.Parse(binary.BytesToString(msgb)))
128128
for _, m := range msgs {
129129
if m.Type == "at" {
130130
qqs, ok := m.Data["qq"]

0 commit comments

Comments
 (0)