Redmind commited on
Commit
1e4fe02
·
verified ·
1 Parent(s): e9396a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -255,7 +255,7 @@ def document_data_tool(question):
255
  return query_response
256
 
257
  # mailjet API since SMTP is not supported HF spaces
258
- def send_email_with_attachment_mailjet(recipient_email, subject, body, attach_img_base64):
259
 
260
 
261
  api_key = os.getenv("MAILJET_API_KEY")
@@ -798,6 +798,9 @@ def handle_dislike(data: gr.LikeData):
798
  def update_message(request: gr.Request):
799
  return f"<h2 style=' font-family: Calibri;'>Welcome, {request.username}</h4>"
800
 
 
 
 
801
 
802
  # CSS for styling the buttons and other elements
803
  css = """
@@ -894,5 +897,6 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
894
  sample_button3.click(handle_query, [sample_button3, chatbot], [chatbot])
895
  sample_button4.click(handle_query, [sample_button4, chatbot], [chatbot])
896
 
 
897
  #user_details for login page
898
  demo.launch(auth=[("lakshmi", "redmind"), ("arun", "redmind")])
 
255
  return query_response
256
 
257
  # mailjet API since SMTP is not supported HF spaces
258
+ def send_email_with_attachment_mailjet(recipient_email, subject, body, attach_img_base64=None):
259
 
260
 
261
  api_key = os.getenv("MAILJET_API_KEY")
 
798
  def update_message(request: gr.Request):
799
  return f"<h2 style=' font-family: Calibri;'>Welcome, {request.username}</h4>"
800
 
801
+ def send_mail_with_history(req: gr.Request, chatbot):
802
+ if req.username:
803
+ send_email_with_attachment_mailjet("[email protected]","conversation history" + req.username, chatbot)
804
 
805
  # CSS for styling the buttons and other elements
806
  css = """
 
897
  sample_button3.click(handle_query, [sample_button3, chatbot], [chatbot])
898
  sample_button4.click(handle_query, [sample_button4, chatbot], [chatbot])
899
 
900
+ demo.unload(send_mail_with history(chatbot))
901
  #user_details for login page
902
  demo.launch(auth=[("lakshmi", "redmind"), ("arun", "redmind")])