From fd6aa919f88d8d5d0b0497f5d56efe1eceae8176 Mon Sep 17 00:00:00 2001 From: PatillaCode Date: Wed, 29 Nov 2023 23:46:27 +0100 Subject: [PATCH] remove unused utils functions split_message --- chat.py | 2 +- utils.py | 23 ----------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/chat.py b/chat.py index a63f5ed..3f39b3f 100644 --- a/chat.py +++ b/chat.py @@ -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() diff --git a/utils.py b/utils.py index d464229..066b7ae 100644 --- a/utils.py +++ b/utils.py @@ -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