修复IndexError

master
落雨楓 2 years ago
parent b1b0bf6fd6
commit 2bd8a2462a

@ -73,7 +73,7 @@ class OpenAIApi:
for line in lines: for line in lines:
line = line.strip() line = line.strip()
# Add a dot at the end of the line if it doesn't end with a punctuation mark # 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 += "." line += "."
new_lines.append(line) new_lines.append(line)
text = " ".join(new_lines) text = " ".join(new_lines)

Loading…
Cancel
Save