[HotFix] Fix final output truncation with stop string + streaming (#8468)

This commit is contained in:
Nick Hill
2024-09-13 19:31:12 +01:00
committed by GitHub
parent f57092c00b
commit 18e9e1f7b3
2 changed files with 24 additions and 6 deletions

View File

@@ -477,7 +477,9 @@ class Sequence:
if not delta:
return self.output_text[:-buffer_length] if truncate else (
self.output_text)
length = len(self.output_text) - buffer_length
length = len(self.output_text)
if truncate:
length -= buffer_length
last_offset = self._last_output_text_offset
if last_offset < length:
self._last_output_text_offset = length