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

Function handleEvents

examples/openrouter/main.go:228–241  ·  view source on GitHub ↗

handleEvents 处理 Agent 事件流

(eventCh <-chan types.AgentEventEnvelope)

Source from the content-addressed store, hash-verified

226
227// handleEvents 处理 Agent 事件流
228func handleEvents(eventCh <-chan types.AgentEventEnvelope) {
229 for envelope := range eventCh {
230 switch e := envelope.Event.(type) {
231 case *types.ProgressToolStartEvent:
232 fmt.Printf("\n🔧 [工具] %s 开始执行...\n", e.Call.Name)
233 case *types.ProgressToolEndEvent:
234 fmt.Printf("✅ [工具] %s 完成\n", e.Call.Name)
235 case *types.ProgressToolErrorEvent:
236 fmt.Printf("❌ [错误] %s: %s\n", e.Call.Name, e.Error)
237 case *types.ProgressDoneEvent:
238 fmt.Printf("📝 [完成] 步骤 %d\n", e.Step)
239 }
240 }
241}

Callers 1

runInteractiveFunction · 0.85

Calls 1

PrintfMethod · 0.80

Tested by

no test coverage detected