dlflannery commited on
Commit
6dec740
·
verified ·
1 Parent(s): 3ab7517

Update app.py

Browse files

Multi-turn email

Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -879,6 +879,9 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel, uploaded_ima
879
  file_out = gr.DownloadButton(value=None)
880
  image_gen_model = 'gpt-4o-2024-08-06'
881
  user_window = user_window.lower().strip()
 
 
 
882
  etext = None
883
  isBoss = False
884
  query = ''
@@ -1173,6 +1176,8 @@ each email. Include suggested action if appropriate:\n''' + etext
1173
  augmented_prompt = f'{news}\nThe topic is: {prompt}\nGive highest priority to information just provided\n'
1174
  augmented_prompt += ' \n' + query
1175
  augmented_prompt += ' \n Do not use Latex for math expressions.'
 
 
1176
  past.append({"role":"user", "content":augmented_prompt})
1177
  gen_image = (uploaded_image_file != '')
1178
  if chatType in special_chat_types:
 
879
  file_out = gr.DownloadButton(value=None)
880
  image_gen_model = 'gpt-4o-2024-08-06'
881
  user_window = user_window.lower().strip()
882
+ if len(past) > 0:
883
+ if past[0]['content'].startswith('email: '):
884
+ mode = 'chat'
885
  etext = None
886
  isBoss = False
887
  query = ''
 
1176
  augmented_prompt = f'{news}\nThe topic is: {prompt}\nGive highest priority to information just provided\n'
1177
  augmented_prompt += ' \n' + query
1178
  augmented_prompt += ' \n Do not use Latex for math expressions.'
1179
+ if etext:
1180
+ augmented_prompt = 'email: ' + augmented_prompt
1181
  past.append({"role":"user", "content":augmented_prompt})
1182
  gen_image = (uploaded_image_file != '')
1183
  if chatType in special_chat_types: