siddhartharya commited on
Commit
63c1516
·
verified ·
1 Parent(s): 83c06a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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\n".join(lines)
118
 
119
  # Truncate the email if it exceeds the word limit
120
- word_count = len(formatted_email.split())
121
- if word_count > self.word_limit:
122
- truncated_email = " ".join(formatted_email.split()[:self.word_limit])
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