Seth commited on
Commit ·
0300245
1
Parent(s): 9d4c52c
Fix variable name conflict in gpt_service.py - email field was getting dict instead of string
Browse files- backend/app/gpt_service.py +12 -12
backend/app/gpt_service.py
CHANGED
|
@@ -225,26 +225,26 @@ If sender_name is not provided, use "Alex Thompson" as the sender name."""
|
|
| 225 |
})
|
| 226 |
|
| 227 |
# Replace template variables in all emails
|
| 228 |
-
for
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
|
| 236 |
# Return list of email sequences
|
| 237 |
return [{
|
| 238 |
"first_name": first_name,
|
| 239 |
"last_name": last_name,
|
| 240 |
-
"email": email,
|
| 241 |
"company": company,
|
| 242 |
"title": title,
|
| 243 |
"product": product_name,
|
| 244 |
-
"email_number":
|
| 245 |
-
"subject":
|
| 246 |
-
"email_content":
|
| 247 |
-
} for
|
| 248 |
|
| 249 |
except Exception as e:
|
| 250 |
print(f"Error generating sequence: {e}")
|
|
|
|
| 225 |
})
|
| 226 |
|
| 227 |
# Replace template variables in all emails
|
| 228 |
+
for email_data in emails:
|
| 229 |
+
email_data["body"] = email_data["body"].replace("{{first_name}}", first_name)
|
| 230 |
+
email_data["body"] = email_data["body"].replace("{{company}}", company)
|
| 231 |
+
email_data["body"] = email_data["body"].replace("{{sender_name}}", "Alex Thompson")
|
| 232 |
+
email_data["subject"] = email_data["subject"].replace("{{first_name}}", first_name)
|
| 233 |
+
email_data["subject"] = email_data["subject"].replace("{{company}}", company)
|
| 234 |
+
email_data["subject"] = email_data["subject"].replace("{{sender_name}}", "Alex Thompson")
|
| 235 |
|
| 236 |
# Return list of email sequences
|
| 237 |
return [{
|
| 238 |
"first_name": first_name,
|
| 239 |
"last_name": last_name,
|
| 240 |
+
"email": email, # This is the contact's email address (string)
|
| 241 |
"company": company,
|
| 242 |
"title": title,
|
| 243 |
"product": product_name,
|
| 244 |
+
"email_number": email_data["email_number"],
|
| 245 |
+
"subject": email_data["subject"],
|
| 246 |
+
"email_content": email_data["body"]
|
| 247 |
+
} for email_data in emails]
|
| 248 |
|
| 249 |
except Exception as e:
|
| 250 |
print(f"Error generating sequence: {e}")
|