fix: reset _repeated_messages_count on empty-choices early return

Address Greptile review: the adjacent null-content guard resets
_repeated_messages_count = 1 before returning, but the new
empty-choices guard did not. Add the reset for consistency so
metadata chunks don't leave a stale counter that could affect
repetition detection on the next real content chunk.
This commit is contained in:
Rishab Motgi 2026-05-18 16:33:41 -07:00
parent edf4b885ba
commit a552da9ad2

View file

@ -270,6 +270,7 @@ class CustomStreamWrapper:
return
if not self.chunks[-1].choices or not self.chunks[-2].choices:
self._repeated_messages_count = 1
return
last_content = self.chunks[-1].choices[0].delta.content