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

Function AgentActorChat

pkg/agent/actor.go:537–552  ·  view source on GitHub ↗

AgentActorChat 向 Agent Actor 发送对话请求并等待响应

(pid *actor.PID, text string, timeout time.Duration)

Source from the content-addressed store, hash-verified

535
536// AgentActorChat 向 Agent Actor 发送对话请求并等待响应
537func AgentActorChat(pid *actor.PID, text string, timeout time.Duration) (*ChatResultMsg, error) {
538 replyCh := make(chan *ChatResultMsg, 1)
539
540 pid.Tell(&ChatMsg{
541 Text: text,
542 Ctx: context.Background(),
543 ReplyTo: replyCh,
544 })
545
546 select {
547 case result := <-replyCh:
548 return result, nil
549 case <-time.After(timeout):
550 return nil, fmt.Errorf("chat request timed out after %v", timeout)
551 }
552}
553
554// AgentActorCallTool 向 Agent Actor 发送工具调用请求并等待响应
555func AgentActorCallTool(pid *actor.PID, toolName string, input map[string]any, timeout time.Duration) (*DirectToolResultMsg, error) {

Callers

nothing calls this directly

Calls 1

TellMethod · 0.80

Tested by

no test coverage detected