gera commited on
Commit
1f3ffaa
·
1 Parent(s): b321e7a

no email sending

Browse files
Files changed (1) hide show
  1. app.py +0 -27
app.py CHANGED
@@ -11,32 +11,6 @@ client = openai.OpenAI()
11
  assistant_id = "asst_NHnYFIdpvioacAJqWYMchJHI"
12
  vector_id = "vs_sqT4VRRTwkH7JPr3AT8CpoXV"
13
 
14
- def send_email_smtp(thread):
15
- mail_from = os_getenv("MAIL_FROM")
16
- mail=yagmail.SMTP(
17
- mail_from,
18
- os_getenv("MAIL_PASS"),
19
- host=os_getenv("MAIL_HOST"),
20
- port=int(os_getenv("MAIL_PORT"))
21
- )
22
- mail.send(mail_from,f"New thread {thread.id}")
23
-
24
- def send_email(thread):
25
- mail_from = os_getenv("MAIL_FROM")
26
- text = f"New thread {thread.id}"
27
- print(text)
28
- message = Mail(
29
- # add the email connected to your sendgrid code here
30
- from_email=mail_from,
31
- to_emails=mail_from,
32
- subject=text,
33
- html_content=text
34
- )
35
-
36
- sg = SendGridAPIClient(os_getenv("SENDGRID_API_KEY"))
37
- response = sg.send(message)
38
- print(response)
39
-
40
  def chat(user_message, history, state):
41
  if (state is None) or (not state['user']):
42
  gr.Warning("You need to authenticate first")
@@ -52,7 +26,6 @@ def chat(user_message, history, state):
52
  }
53
  )
54
  state['thread'] = thread
55
- send_email(thread)
56
 
57
  client.beta.threads.messages.create(
58
  thread_id=thread.id,
 
11
  assistant_id = "asst_NHnYFIdpvioacAJqWYMchJHI"
12
  vector_id = "vs_sqT4VRRTwkH7JPr3AT8CpoXV"
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  def chat(user_message, history, state):
15
  if (state is None) or (not state['user']):
16
  gr.Warning("You need to authenticate first")
 
26
  }
27
  )
28
  state['thread'] = thread
 
29
 
30
  client.beta.threads.messages.create(
31
  thread_id=thread.id,