Update app.py
Browse files
app.py
CHANGED
@@ -114,13 +114,13 @@ class AutonomousEmailAgent:
|
|
114 |
def format_email(self, llm_response):
|
115 |
# Clean and format the email
|
116 |
lines = [line.strip() for line in llm_response.split("\n") if line.strip()]
|
117 |
-
formatted_email = "\n
|
118 |
|
119 |
# Truncate the email if it exceeds the word limit
|
120 |
-
|
121 |
-
if
|
122 |
-
truncated_email = " ".join(
|
123 |
-
formatted_email = truncated_email
|
124 |
|
125 |
# Prepare the signature
|
126 |
signature = (
|
@@ -131,7 +131,7 @@ class AutonomousEmailAgent:
|
|
131 |
f"LinkedIn: {self.linkedin}"
|
132 |
)
|
133 |
|
134 |
-
# Ensure only one "Best regards" section
|
135 |
if "Best regards" in formatted_email:
|
136 |
formatted_email = formatted_email.split("Best regards")[0].strip()
|
137 |
|
|
|
114 |
def format_email(self, llm_response):
|
115 |
# Clean and format the email
|
116 |
lines = [line.strip() for line in llm_response.split("\n") if line.strip()]
|
117 |
+
formatted_email = "\n".join(lines)
|
118 |
|
119 |
# Truncate the email if it exceeds the word limit
|
120 |
+
words = formatted_email.split()
|
121 |
+
if len(words) > self.word_limit:
|
122 |
+
truncated_email = " ".join(words[:self.word_limit]) + "..."
|
123 |
+
formatted_email = truncated_email
|
124 |
|
125 |
# Prepare the signature
|
126 |
signature = (
|
|
|
131 |
f"LinkedIn: {self.linkedin}"
|
132 |
)
|
133 |
|
134 |
+
# Ensure only one "Best regards" section and remove any duplicate signatures
|
135 |
if "Best regards" in formatted_email:
|
136 |
formatted_email = formatted_email.split("Best regards")[0].strip()
|
137 |
|