(c *gin.Context, requestId string, content string, toolCallId string, functionName string, streamType string)
| 1100 | } |
| 1101 | |
| 1102 | func 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 | |
| 1132 | func compactToolResultPreview(result string) (string, bool) { |
| 1133 | result = extractHTTPBodyFromToolOutput(result) |
no test coverage detected