修复接续流的增量bug

This commit is contained in:
CJACK
2026-04-06 02:01:41 +08:00
parent a608a4bd95
commit 4d36afea4c
9 changed files with 140 additions and 21 deletions

View File

@@ -54,9 +54,11 @@ func CollectStream(resp *http.Response, thinkingEnabled bool, closeBody bool) Co
}
for _, p := range result.Parts {
if p.Type == "thinking" {
thinking.WriteString(p.Text)
trimmed := TrimContinuationOverlap(thinking.String(), p.Text)
thinking.WriteString(trimmed)
} else {
text.WriteString(p.Text)
trimmed := TrimContinuationOverlap(text.String(), p.Text)
text.WriteString(trimmed)
}
}
return true