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
Files changed (1) hide show
  1. 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 email in emails:
229
- email["body"] = email["body"].replace("{{first_name}}", first_name)
230
- email["body"] = email["body"].replace("{{company}}", company)
231
- email["body"] = email["body"].replace("{{sender_name}}", "Alex Thompson")
232
- email["subject"] = email["subject"].replace("{{first_name}}", first_name)
233
- email["subject"] = email["subject"].replace("{{company}}", company)
234
- email["subject"] = email["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,
241
  "company": company,
242
  "title": title,
243
  "product": product_name,
244
- "email_number": email["email_number"],
245
- "subject": email["subject"],
246
- "email_content": email["body"]
247
- } for email in emails]
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}")