Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -127,7 +127,7 @@ def page1():
|
|
127 |
|
128 |
VectorStore = load_vector_store(pdf_path, "vector_store_page1", force_reload=False)
|
129 |
|
130 |
-
display_chat_history(st.session_state['
|
131 |
|
132 |
st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
|
133 |
st.write("<div style='flex: 1;'></div>", unsafe_allow_html=True)
|
@@ -161,7 +161,7 @@ def page1():
|
|
161 |
|
162 |
|
163 |
if query:
|
164 |
-
st.session_state['
|
165 |
|
166 |
# Start timing
|
167 |
start_time = time.time()
|
@@ -183,11 +183,11 @@ def page1():
|
|
183 |
# You can use Streamlit's text function to display the timing
|
184 |
st.text(f"Response time: {duration:.2f} seconds")
|
185 |
|
186 |
-
st.session_state['
|
187 |
|
188 |
|
189 |
# Display new messages at the bottom
|
190 |
-
new_messages = st.session_state['
|
191 |
for chat in new_messages:
|
192 |
background_color = "#ffeecf" if chat[2] == "new" else "#ffeecf" if chat[0] == "User" else "#ffeecf"
|
193 |
new_messages_placeholder.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
|
@@ -239,7 +239,7 @@ def page2():
|
|
239 |
|
240 |
|
241 |
|
242 |
-
display_chat_history(st.session_state['
|
243 |
|
244 |
st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
|
245 |
st.write("<div style='flex: 1;'></div>", unsafe_allow_html=True)
|
|
|
127 |
|
128 |
VectorStore = load_vector_store(pdf_path, "vector_store_page1", force_reload=False)
|
129 |
|
130 |
+
display_chat_history(st.session_state['chat_history_page1'])
|
131 |
|
132 |
st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
|
133 |
st.write("<div style='flex: 1;'></div>", unsafe_allow_html=True)
|
|
|
161 |
|
162 |
|
163 |
if query:
|
164 |
+
st.session_state['chat_history_page1'].append(("User", query, "new"))
|
165 |
|
166 |
# Start timing
|
167 |
start_time = time.time()
|
|
|
183 |
# You can use Streamlit's text function to display the timing
|
184 |
st.text(f"Response time: {duration:.2f} seconds")
|
185 |
|
186 |
+
st.session_state['chat_history_page1'].append(("Bot", response, "new"))
|
187 |
|
188 |
|
189 |
# Display new messages at the bottom
|
190 |
+
new_messages = st.session_state['chat_history_page1'][-2:]
|
191 |
for chat in new_messages:
|
192 |
background_color = "#ffeecf" if chat[2] == "new" else "#ffeecf" if chat[0] == "User" else "#ffeecf"
|
193 |
new_messages_placeholder.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
|
|
|
239 |
|
240 |
|
241 |
|
242 |
+
display_chat_history(st.session_state['chat_history_page2'])
|
243 |
|
244 |
st.write("<!-- Start Spacer -->", unsafe_allow_html=True)
|
245 |
st.write("<div style='flex: 1;'></div>", unsafe_allow_html=True)
|