Files
wehub-resource-sync 1b8708893a
Security Scan / tests (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:12:26 +08:00

19 lines
572 B
Go

package functions
import "strings"
// StripToolCallMarkup extracts the non-tool-call content from a string
// by reusing the iterative XML parser which already separates content
// from tool calls. Returns the remaining text, trimmed.
func StripToolCallMarkup(content string) string {
for _, fmtPreset := range getAllXMLFormats() {
if fmtPreset.format == nil {
continue
}
if pr, ok := tryParseXMLFromScopeStart(content, fmtPreset.format, false); ok && len(pr.ToolCalls) > 0 {
return strings.TrimSpace(pr.Content)
}
}
return strings.TrimSpace(content)
}