cogcorp commited on
Commit
9ce4bfa
·
1 Parent(s): 471aecf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -35,8 +35,10 @@ def call_openai_api(user_prompt):
35
  {"role": "system", "content": "You are a research assistant. Provide factual short answers to your prompts. The user will provide reference data followed by instructions."},
36
  {"role": "user", "content": f"{text}\n\n{user_prompt}"},
37
  ]
38
- )
39
- return response.choices[0].message['content']
 
 
40
  except Exception as e:
41
  if attempt < max_retries - 1: # if it's not the last attempt
42
  time.sleep(1) # wait for 1 seconds before retrying
 
35
  {"role": "system", "content": "You are a research assistant. Provide factual short answers to your prompts. The user will provide reference data followed by instructions."},
36
  {"role": "user", "content": f"{text}\n\n{user_prompt}"},
37
  ]
38
+ )
39
+ ai_response = response.choices[0].message['content']
40
+ chat_history += f"\nUser: {user_prompt}\nAI: {ai_response}"
41
+ return chat_history
42
  except Exception as e:
43
  if attempt < max_retries - 1: # if it's not the last attempt
44
  time.sleep(1) # wait for 1 seconds before retrying