updateToolRecord 更新工具记录
(id string, state types.ToolCallState, errorMsg string)
| 846 | |
| 847 | // updateToolRecord 更新工具记录 |
| 848 | func (a *Agent) updateToolRecord(id string, state types.ToolCallState, errorMsg string) { |
| 849 | a.mu.Lock() |
| 850 | defer a.mu.Unlock() |
| 851 | |
| 852 | record, ok := a.toolRecords[id] |
| 853 | if !ok { |
| 854 | return |
| 855 | } |
| 856 | |
| 857 | now := time.Now() |
| 858 | record.State = state |
| 859 | record.UpdatedAt = now |
| 860 | |
| 861 | if errorMsg != "" { |
| 862 | record.Error = errorMsg |
| 863 | record.IsError = true |
| 864 | } |
| 865 | |
| 866 | record.AuditTrail = append(record.AuditTrail, types.ToolCallAuditEntry{ |
| 867 | State: state, |
| 868 | Timestamp: now, |
| 869 | }) |
| 870 | } |
| 871 | |
| 872 | // handleStreamResponse 处理流式响应(Phase 6C - 提取为独立方法以支持Middleware) |
| 873 | func (a *Agent) handleStreamResponse(ctx context.Context, stream <-chan provider.StreamChunk) (types.Message, error) { |
no outgoing calls
no test coverage detected