fix: multiline

Signed-off-by: mudler <mudler@localai.io>
This commit is contained in:
mudler
2025-04-30 11:44:26 +02:00
parent 1109b0a533
commit 45dd74d27c

View File

@@ -791,10 +791,10 @@ func (a *Agent) consumeJob(job *types.Job, role string) {
} }
func stripThinkingTags(content string) string { func stripThinkingTags(content string) string {
// Remove content between <thinking> and </thinking> // Remove content between <thinking> and </thinking> (including multi-line)
content = regexp.MustCompile(`<thinking>.*?</thinking>`).ReplaceAllString(content, "") content = regexp.MustCompile(`(?s)<thinking>.*?</thinking>`).ReplaceAllString(content, "")
// Remove content between <think> and </think> // Remove content between <think> and </think> (including multi-line)
content = regexp.MustCompile(`<think>.*?</think>`).ReplaceAllString(content, "") content = regexp.MustCompile(`(?s)<think>.*?</think>`).ReplaceAllString(content, "")
// Clean up any extra whitespace // Clean up any extra whitespace
content = strings.TrimSpace(content) content = strings.TrimSpace(content)
return content return content