ogegadavis254 commited on
Commit
01d4f3f
·
verified ·
1 Parent(s): 1e8b2e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -4,7 +4,6 @@
4
  """
5
 
6
  import streamlit as st
7
- from openai import OpenAI
8
  import os
9
  import requests
10
  import json
@@ -13,11 +12,14 @@ entire_assistant_response = ""
13
 
14
  def get_streamed_response(message, history, model):
15
  all_message = []
16
-
 
 
 
17
  for human, assistant in history:
18
  all_message.append({"role": "user", "content": human})
19
  all_message.append({"role": "assistant", "content": assistant})
20
-
21
  global entire_assistant_response
22
  entire_assistant_response = "" # Reset the entire assistant response
23
 
 
4
  """
5
 
6
  import streamlit as st
 
7
  import os
8
  import requests
9
  import json
 
12
 
13
  def get_streamed_response(message, history, model):
14
  all_message = []
15
+
16
+ if not history: # If history is empty
17
+ all_message.append({"role": "user", "content": ""})
18
+
19
  for human, assistant in history:
20
  all_message.append({"role": "user", "content": human})
21
  all_message.append({"role": "assistant", "content": assistant})
22
+
23
  global entire_assistant_response
24
  entire_assistant_response = "" # Reset the entire assistant response
25