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)