Update app.py
Browse files
app.py
CHANGED
@@ -314,7 +314,10 @@ def run_streamlit_app():
|
|
314 |
if question := st.chat_input("Enter your question"):
|
315 |
if st.session_state.query_engine:
|
316 |
with st.spinner('Generating response...'):
|
317 |
-
|
|
|
|
|
|
|
318 |
logging.info(f"Generated response: {response.response}")
|
319 |
logging.info(f"Retrieved contexts: {[node.text for node in response.source_nodes]}")
|
320 |
question_id = str(uuid.uuid4())
|
|
|
314 |
if question := st.chat_input("Enter your question"):
|
315 |
if st.session_state.query_engine:
|
316 |
with st.spinner('Generating response...'):
|
317 |
+
# Compile chat history for context
|
318 |
+
history = "\n".join([f"Q: {chat['user']}\nA: {chat['response']}" for chat in st.session_state.chat_history])
|
319 |
+
full_query = f"{history}\nQ: {question}"
|
320 |
+
response = st.session_state.query_engine.query(full_query)
|
321 |
logging.info(f"Generated response: {response.response}")
|
322 |
logging.info(f"Retrieved contexts: {[node.text for node in response.source_nodes]}")
|
323 |
question_id = str(uuid.uuid4())
|