MCPcopy Create free account
hub / github.com/53AI/53AIHub / queueToolLogDelta

Function queueToolLogDelta

api/controller/relay/relay_agent.go:1102–1130  ·  view source on GitHub ↗
(c *gin.Context, requestId string, content string, toolCallId string, functionName string, streamType string)

Source from the content-addressed store, hash-verified

1100}
1101
1102func queueToolLogDelta(c *gin.Context, requestId string, content string, toolCallId string, functionName string, streamType string) {
1103 if content == "" {
1104 return
1105 }
1106 if !config.IsSSECompactMode() {
1107 step := ProcessStep{
1108 StepCode: "tool_log_delta",
1109 Name: "工具输出",
1110 Status: "streaming",
1111 Message: "",
1112 Data: map[string]interface{}{"content": content, "type": streamType, "tool_call_id": toolCallId, "function_name": functionName},
1113 Timestamp: time.Now().Unix(),
1114 }
1115 if err := sendProcessStep(c, requestId, step); err != nil {
1116 logger.Warnf(c, "Failed to send tool_log_delta step: %v", err)
1117 }
1118 return
1119 }
1120
1121 key := fmt.Sprintf("%s|%s", toolCallId, streamType)
1122 buffers := getToolLogDeltaBuffers(c)
1123 buf, ok := buffers[key]
1124 if !ok || buf == nil {
1125 buf = &toolLogDeltaBuffer{LastFlush: time.Now()}
1126 buffers[key] = buf
1127 }
1128 buf.Content.WriteString(content)
1129 flushToolLogDeltaBuffer(c, requestId, key, toolCallId, functionName, streamType, false)
1130}
1131
1132func compactToolResultPreview(result string) (string, bool) {
1133 result = extractHTTPBodyFromToolOutput(result)

Callers 1

handleSandboxStreamEventFunction · 0.85

Calls 5

sendProcessStepFunction · 0.85
getToolLogDeltaBuffersFunction · 0.85
flushToolLogDeltaBufferFunction · 0.85
WarnfMethod · 0.80
WriteStringMethod · 0.80

Tested by

no test coverage detected