MCPcopy Create free account
hub / github.com/astercloud/aster / handleSend

Method handleSend

pkg/agent/actor.go:265–279  ·  view source on GitHub ↗

handleSend 处理发送消息(异步)

(ctx *actor.Context, msg *SendMsg)

Source from the content-addressed store, hash-verified

263
264// handleSend 处理发送消息(异步)
265func (a *AgentActor) handleSend(ctx *actor.Context, msg *SendMsg) {
266 execCtx, cancel := a.withCancellation(msg.Ctx)
267 defer cancel()
268
269 go func() {
270 err := a.agent.Send(execCtx, msg.Text)
271
272 if err != nil && !errors.Is(err, context.Canceled) {
273 a.recordError(err)
274 if ctx.Sender != nil {
275 ctx.Reply(&ErrorMsg{Error: err, Context: "send"})
276 }
277 }
278 }()
279}
280
281// handleChat 处理同步对话
282func (a *AgentActor) handleChat(ctx *actor.Context, msg *ChatMsg) {

Callers 1

ReceiveMethod · 0.95

Calls 5

withCancellationMethod · 0.95
recordErrorMethod · 0.95
cancelFunction · 0.85
ReplyMethod · 0.80
SendMethod · 0.45

Tested by

no test coverage detected