Skip to content

Commit 62584a9

Browse files
fix: detect partial stop sequences by output suffix
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 587d5cf commit 62584a9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fastchat/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ def parse_gradio_auth_creds(filename: str):
329329

330330

331331
def is_partial_stop(output: str, stop_str: str):
332-
"""Check whether the output contains a partial stop str."""
333-
for i in range(0, min(len(output), len(stop_str))):
332+
"""Check whether the output ends with a partial stop str."""
333+
for i in range(1, min(len(output), len(stop_str)) + 1):
334334
if stop_str.startswith(output[-i:]):
335335
return True
336336
return False

0 commit comments

Comments
 (0)