OnAgentStop Agent 停止时停止事件处理器
(ctx context.Context, agentID string)
| 167 | |
| 168 | // OnAgentStop Agent 停止时停止事件处理器 |
| 169 | func (m *LogicMemoryMiddleware) OnAgentStop(ctx context.Context, agentID string) error { |
| 170 | // 停止异步事件处理 |
| 171 | if m.config.AsyncCapture && m.config.EnableCapture { |
| 172 | close(m.stopCh) |
| 173 | m.wg.Wait() |
| 174 | lmLog.Info(context.Background(), "stopped async event processor", map[string]any{"agent_id": agentID}) |
| 175 | } |
| 176 | return nil |
| 177 | } |
| 178 | |
| 179 | // WrapModelCall 包装模型调用,注入 Logic Memory 到 system prompt |
| 180 | func (m *LogicMemoryMiddleware) WrapModelCall(ctx context.Context, req *ModelRequest, handler ModelCallHandler) (*ModelResponse, error) { |