Update app.py
Browse files
app.py
CHANGED
@@ -112,9 +112,9 @@ class AutonomousEmailAgent:
|
|
112 |
return "Error: Unable to generate response."
|
113 |
|
114 |
def format_email(self, llm_response):
|
115 |
-
# Clean and format the email
|
116 |
-
|
117 |
-
formatted_email = "\n\n".join(
|
118 |
|
119 |
# Truncate the email if it exceeds the word limit
|
120 |
words = formatted_email.split()
|
@@ -125,7 +125,7 @@ class AutonomousEmailAgent:
|
|
125 |
# Add the closing section with a call to action
|
126 |
closing_section = (
|
127 |
"\n\nI would appreciate the opportunity to discuss how my background, skills, and passion align with the goals "
|
128 |
-
"of
|
129 |
"Thank you for considering my application. I look forward to the possibility of discussing this role further.\n"
|
130 |
)
|
131 |
|
@@ -142,7 +142,7 @@ class AutonomousEmailAgent:
|
|
142 |
if "Best regards" in formatted_email:
|
143 |
formatted_email = formatted_email.split("Best regards")[0].strip()
|
144 |
|
145 |
-
return f"{formatted_email}{closing_section}\n{signature}"
|
146 |
|
147 |
# Gradio UI setup remains unchanged
|
148 |
def gradio_ui():
|
|
|
112 |
return "Error: Unable to generate response."
|
113 |
|
114 |
def format_email(self, llm_response):
|
115 |
+
# Clean and format the email into paragraphs
|
116 |
+
paragraphs = [line.strip() for line in llm_response.split("\n") if line.strip()]
|
117 |
+
formatted_email = "\n\n".join(paragraphs)
|
118 |
|
119 |
# Truncate the email if it exceeds the word limit
|
120 |
words = formatted_email.split()
|
|
|
125 |
# Add the closing section with a call to action
|
126 |
closing_section = (
|
127 |
"\n\nI would appreciate the opportunity to discuss how my background, skills, and passion align with the goals "
|
128 |
+
f"of {self.company_name}. I am eager to contribute to your mission and support the development of future leaders.\n\n"
|
129 |
"Thank you for considering my application. I look forward to the possibility of discussing this role further.\n"
|
130 |
)
|
131 |
|
|
|
142 |
if "Best regards" in formatted_email:
|
143 |
formatted_email = formatted_email.split("Best regards")[0].strip()
|
144 |
|
145 |
+
return f"{formatted_email}\n{closing_section}\n{signature}"
|
146 |
|
147 |
# Gradio UI setup remains unchanged
|
148 |
def gradio_ui():
|