From 62584a9708b2d5e0ab0743622bf47fad4fc7c55b Mon Sep 17 00:00:00 2001 From: Taksh Date: Tue, 2 Jun 2026 07:39:09 +0530 Subject: [PATCH] fix: detect partial stop sequences by output suffix Co-authored-by: Cursor --- fastchat/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastchat/utils.py b/fastchat/utils.py index d3531928f..7b99cfca5 100644 --- a/fastchat/utils.py +++ b/fastchat/utils.py @@ -329,8 +329,8 @@ def parse_gradio_auth_creds(filename: str): def is_partial_stop(output: str, stop_str: str): - """Check whether the output contains a partial stop str.""" - for i in range(0, min(len(output), len(stop_str))): + """Check whether the output ends with a partial stop str.""" + for i in range(1, min(len(output), len(stop_str)) + 1): if stop_str.startswith(output[-i:]): return True return False