diff --git a/fastchat/utils.py b/fastchat/utils.py index d3531928f..13c9f1453 100644 --- a/fastchat/utils.py +++ b/fastchat/utils.py @@ -330,7 +330,7 @@ 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))): + for i in range(1, min(len(output), len(stop_str)) + 1): if stop_str.startswith(output[-i:]): return True return False