Skip to content

Commit

Permalink
remove unused utils functions split_message
Browse files Browse the repository at this point in the history
  • Loading branch information
patillacode committed Nov 29, 2023
1 parent 023e71d commit fd6aa91
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
2 changes: 1 addition & 1 deletion chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from openai import OpenAI
from rich.console import Console

from utils import display_output, handle_error, split_message
from utils import display_output, handle_error

load_dotenv()
client = OpenAI()
Expand Down
23 changes: 0 additions & 23 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,3 @@ def handle_error(exception, verbose=False):
display_output(f"Error: {str(exception)}", "red")
if verbose:
display_output(traceback.format_exc(), "cyan")


def split_message(message, max_line_length=90, min_line_length=60):
lines = []
current_line = ""

words = message.split()

for word in words:
if len(current_line) + len(word) + 1 <= max_line_length:
current_line += word + " "
else:
if len(current_line) >= min_line_length:
lines.append(current_line.rstrip())
current_line = word + " "
else:
lines.append(current_line.rstrip() + word + " ")
current_line = ""

if current_line:
lines.append(current_line.rstrip())

return lines

0 comments on commit fd6aa91

Please sign in to comment.