Update app.py
Browse files
app.py
CHANGED
|
@@ -37,8 +37,7 @@ index = pinecone.Index(index_name)
|
|
| 37 |
k = 5
|
| 38 |
|
| 39 |
|
| 40 |
-
|
| 41 |
-
st.session_state.messages = []
|
| 42 |
|
| 43 |
|
| 44 |
st.title("USC GPT - Find the perfect class")
|
|
@@ -60,6 +59,7 @@ units = st.slider(
|
|
| 60 |
# with st.chat_message(message["role"]):
|
| 61 |
# st.markdown(message["content"])
|
| 62 |
|
|
|
|
| 63 |
for message in st.session_state.messages:
|
| 64 |
with st.chat_message(message["role"]):
|
| 65 |
st.markdown(message["content"])
|
|
@@ -81,7 +81,9 @@ def assistant_response(response):
|
|
| 81 |
# Add assistant response to chat history
|
| 82 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
| 83 |
|
| 84 |
-
|
|
|
|
|
|
|
| 85 |
|
| 86 |
if prompt := st.chat_input("What kind of class are you looking for?"):
|
| 87 |
with st.chat_message("user"):
|
|
|
|
| 37 |
k = 5
|
| 38 |
|
| 39 |
|
| 40 |
+
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
st.title("USC GPT - Find the perfect class")
|
|
|
|
| 59 |
# with st.chat_message(message["role"]):
|
| 60 |
# st.markdown(message["content"])
|
| 61 |
|
| 62 |
+
|
| 63 |
for message in st.session_state.messages:
|
| 64 |
with st.chat_message(message["role"]):
|
| 65 |
st.markdown(message["content"])
|
|
|
|
| 81 |
# Add assistant response to chat history
|
| 82 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
| 83 |
|
| 84 |
+
if "messages" not in st.session_state:
|
| 85 |
+
st.session_state.messages = []
|
| 86 |
+
assistant_response(initial_message)
|
| 87 |
|
| 88 |
if prompt := st.chat_input("What kind of class are you looking for?"):
|
| 89 |
with st.chat_message("user"):
|