From 2bd8a2462a187b7949b02d43866ae035ea48439f Mon Sep 17 00:00:00 2001 From: Lex Lim Date: Mon, 3 Jul 2023 15:38:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIndexError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/openai_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/openai_api.py b/service/openai_api.py index 51d61b6..89bdba3 100644 --- a/service/openai_api.py +++ b/service/openai_api.py @@ -73,7 +73,7 @@ class OpenAIApi: for line in lines: line = line.strip() # Add a dot at the end of the line if it doesn't end with a punctuation mark - if regex.find(line[-1]) == -1: + if len(line) > 0 and regex.find(line[-1]) == -1: line += "." new_lines.append(line) text = " ".join(new_lines)